public void HandlesCardAssigned() { 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.Assignee.Should().Be("Jason Mitchell"); }
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 void HandlesDevelopmentStarted() { 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.Status.Should().Be(CardStatus.InProgress); }
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 HandlesTaskOpened() { var cardId = RandomId(); var dateOpened = DateTime.UtcNow; var card = new CardAggregate(cardId); card.Load(new[] { new TaskOpened(cardId, dateOpened, "Test") }); card.Type.Should().Be(CardType.Task); card.DateOpened.Should().Be(dateOpened); card.Status.Should().Be(CardStatus.ToDo); card.Title.Should().Be("Test"); }
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 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()); }