public void AddVote_WithAlreadyExistingParticipant_ShouldThrowDomainException() { // Arrange const string participantEmailAddress = "*****@*****.**"; Option option = this.GetOption(); option.AddVote(participantEmailAddress, DateTime.Now); const string expectedExceptionMessage = "You have already voted for this poll"; // Act DomainException actualException = Assert.Throws <DomainException>(() => option.AddVote(participantEmailAddress, DateTime.Now)); // Assert actualException.Message.Should().Contain(expectedExceptionMessage); }
public void AddVote_WithValidData_ShouldAddNewVote() { // Arrange const string participantEmailAddress = "*****@*****.**"; Option option = this.GetOption(); // Act option.AddVote(participantEmailAddress, DateTime.Now); // Assert option.Votes.Count.Should().Be(1); }