コード例 #1
0
        public void CheckWhenNegativeAge_ThrowsArgumentOutOfRangeException()
        {
            // Arrange
            VotingValidator validator = new VotingValidator();
            int             age       = -20;

            // Act
            bool actualOutcome = validator.Check(age);

            // Assert - Exception should be thrown
        }
コード例 #2
0
        public void CheckWhen17_ReturnsFalse()
        {
            // Arrange
            VotingValidator validator       = new VotingValidator();
            int             age             = 17;
            bool            expectedOutcome = false;

            // Act
            bool actualOutcome = validator.Check(age);

            // Assert
            Assert.AreEqual(expectedOutcome, actualOutcome);
        }
コード例 #3
0
        public void CheckWhenOlderThan17_ReturnTrue()
        {
            // Arrange
            VotingValidator validator = new VotingValidator();
            int             age       = 41;


            // Act
            bool youMayVote = validator.Check(age);

            // Assert
            Assert.IsTrue(youMayVote);
        }