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); }