public void DoesNotAllowDevelopmentToStartWithoutAssignee() { var cardId = RandomId(); var card = new CardAggregate(cardId); card.Load(new Event[] { new TaskOpened(cardId, DateTime.UtcNow, "Test") }); Action action = () => card.StartDevelopment(); action.Should().ThrowExactly <AssigneeIsRequiredException>(); }
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()); }