public void TaskIsOpened() { var card = new CardAggregate(RandomId()); card.OpenTask("Test"); var changes = card.GetChanges(); changes.Should().BeEquivalentTo(new[] { new TaskOpened(card.Id, DateTime.UtcNow, "Test"), }, opt => opt.Excluding(x => x.DateOpened).WithStrictOrdering()); }
public void CardIsAssigned() { var cardId = RandomId(); var card = new CardAggregate(cardId); card.Load(new[] { new TaskOpened(cardId, DateTime.UtcNow, "Test") }); card.AssignTo("Jason Mitchell"); var changes = card.GetChanges(); changes.Should().BeEquivalentTo(new CardAssigned(card.Id, null, "Jason Mitchell")); }
public void NoChangesAreRaisedWhenAssigneeHasNotChanged() { var cardId = RandomId(); var card = new CardAggregate(cardId); card.Load(new Event[] { new TaskOpened(cardId, DateTime.UtcNow, "Test"), new CardAssigned(card.Id, null, "Jason Mitchell") }); card.AssignTo("Jason Mitchell"); var changes = card.GetChanges(); changes.Should().BeEmpty(); }
public async Task SavesCardAggregateChangesToStream() { var cardId = RandomId(); var card = new CardAggregate(cardId); card.OpenTask("Test"); card.AssignTo("Jason Mitchell"); card.StartDevelopment(); var expectedChanges = card.GetChanges().ToArray(); await _aggregateStore.Save(card); var streamName = $"Card-{cardId}"; await _esdb.AssertStreamExists(streamName); await _esdb.AssertEvents(streamName, expectedChanges); }
public void NoChangesAreRaisedWhenDevelopmentHasAlreadyStarted() { var cardId = RandomId(); var card = new CardAggregate(cardId); card.Load(new Event[] { new TaskOpened(cardId, DateTime.UtcNow, "Test"), new CardAssigned(card.Id, null, "Jason Mitchell"), new DevelopmentStarted(cardId, DateTime.UtcNow) }); card.StartDevelopment(); var changes = card.GetChanges(); changes.Should().BeEmpty(); }
public void DevelopmentIsStarted() { var cardId = RandomId(); var card = new CardAggregate(cardId); card.Load(new Event[] { new TaskOpened(cardId, DateTime.UtcNow, "Test"), new CardAssigned(card.Id, null, "Jason Mitchell") }); card.StartDevelopment(); var changes = card.GetChanges(); changes.Should().BeEquivalentTo(new[] { new DevelopmentStarted(card.Id, DateTime.UtcNow), }, opt => opt.Excluding(x => x.DateStarted).WithStrictOrdering()); }