Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken committed Jul 3, 2024
1 parent 29461af commit 6d5d8f8
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace MinimalRichDomain.Tests;

public class AggregateTests
public class EventSourcedEntityTests
{
[Fact]
public void CannotApplyEventWithLowerVersion()
{
var domainEvent = new TestDomainEvent(-1);
var testAggregate = new TestAggregate();
var testAggregate = new TestEventSourcedEntity();

var action = () => testAggregate.ApplyForTest(domainEvent);

Expand All @@ -19,7 +19,7 @@ public void CannotApplyEventWithLowerVersion()
public void CannotApplyEventWithSameVersion()
{
var domainEvent = new TestDomainEvent(0);
var testAggregate = new TestAggregate();
var testAggregate = new TestEventSourcedEntity();

var action = () => testAggregate.ApplyForTest(domainEvent);

Expand All @@ -30,7 +30,7 @@ public void CannotApplyEventWithSameVersion()
public void CannotApplyEventWithTooHighVersion()
{
var domainEvent = new TestDomainEvent(2);
var testAggregate = new TestAggregate();
var testAggregate = new TestEventSourcedEntity();

var action = () => testAggregate.ApplyForTest(domainEvent);

Expand All @@ -41,7 +41,7 @@ public void CannotApplyEventWithTooHighVersion()
public void CanApplyEventWithIncrementalVersion()
{
var domainEvent = new TestDomainEvent(1);
var testAggregate = new TestAggregate();
var testAggregate = new TestEventSourcedEntity();

testAggregate.ApplyForTest(domainEvent);

Expand All @@ -56,7 +56,7 @@ public void CanRehydrateWithCompleteHistory()
var domainEvent3 = new TestDomainEvent(3);
var history = new List<TestDomainEvent> { domainEvent1, domainEvent2, domainEvent3 };

TestAggregate action() => new(history);
TestEventSourcedEntity action() => new(history);

FluentActions.Invoking(action).Should().NotThrow("the history is complete.");
}
Expand All @@ -65,7 +65,7 @@ public void CanRehydrateWithCompleteHistory()
public void CanNotApplyEventThatsNotImplemented()
{
var domainEvent = new TestDomainEventNotImplemented(1);
var testAggregate = new TestAggregate();
var testAggregate = new TestEventSourcedEntity();

void action() => testAggregate.ApplyForTest(domainEvent);

Expand All @@ -75,13 +75,13 @@ public void CanNotApplyEventThatsNotImplemented()
private sealed record class TestDomainEvent(int EntityVersion) : IDomainEvent;
private sealed record class TestDomainEventNotImplemented(int EntityVersion) : IDomainEvent;

private class TestAggregate : Aggregate<Guid>
private class TestEventSourcedEntity : EventSourcedEntity<Guid>
{
public TestAggregate() : base(Guid.NewGuid())
public TestEventSourcedEntity() : base(Guid.NewGuid())
{
}

public TestAggregate(IReadOnlyCollection<IDomainEvent> domainEvents) : base(Guid.NewGuid(), domainEvents) { }
public TestEventSourcedEntity(IReadOnlyCollection<IDomainEvent> domainEvents) : base(Guid.NewGuid(), domainEvents) { }

public void ApplyForTest(IDomainEvent domainEvent)
{
Expand Down

0 comments on commit 6d5d8f8

Please sign in to comment.