public void Given_Topics_When_CreateVoting_Then_VotingCreated() { // Arrange var sut = new VotingAggregate(); var topics = new[] { "C#", "F#", "Java", "JS" }; // Act sut.CreateVoting(topics); // Assert var result = sut.GetPendingEvents().OfType <VotingCreatedEvent>().First(); Assert.NotNull(result); Assert.Equal(result.Topics, topics); }
public void Given_CreatedVoting_WithOneTopic_When_StartVoting_Then_VotingFinished() { // Arrange var sut = new VotingAggregate(); sut.CreateVoting("C#"); // Act sut.StartNextVoting(); // Assert var result = sut.GetPendingEvents().OfType <VotingFinishedEvent>().First(); Assert.NotNull(result); Assert.Equal(result.Winner, "C#"); }
public void Given_CreatedVoting_When_StartNextVoting_Then_VotingStarted() { // Arrange var sut = new VotingAggregate(); sut.CreateVoting("C#", "F#", "VB.NET", "PowerShell"); // Act sut.StartNextVoting(); // Assert var result = sut.GetPendingEvents().OfType <VotingStartedEvent>().First(); Assert.NotNull(result); Assert.Equal(result.VotingPair.TopicA, ("C#", 0)); Assert.Equal(result.VotingPair.TopicB, ("F#", 0)); Assert.Equal(result.RemainingTopics, new[] { "VB.NET", "PowerShell" }); }
public void Given_StartedVoting_When_VoteManyTimes_Then_VotingStarted() { // Arrange var sut = new VotingAggregate(); sut.CreateVoting("C#", "F#"); sut.StartNextVoting(); // Act sut.VoteTopic("C#"); sut.VoteTopic("F#"); sut.StartNextVoting(); // Assert var result = sut.GetPendingEvents().OfType <VotingStartedEvent>().First(); Assert.NotNull(result); Assert.Equal(result.VotingPair.TopicA, ("C#", 0)); Assert.Equal(result.VotingPair.TopicB, ("F#", 0)); }