示例#1
0
        public void IsNumberEven(int number, bool expected)
        {
            // Arrange
            ChallengeSet02 challenger = new ChallengeSet02();

            // Act
            bool actual = challenger.IsNumberEven(number);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#2
0
        public void CountOfPositiveOddsBelowNumber(int number, int expected)
        {
            // Arrange
            ChallengeSet02 challenger = new ChallengeSet02();

            // Act
            double actual = challenger.CountOfPositiveOddsBelowNumber(number);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#3
0
        // [InlineData(null, false)] // Assumption: array will not be null
        public void CountOfElementsIsEven(string[] strings, bool expected)
        {
            // Arrange
            ChallengeSet02 challenger = new ChallengeSet02();

            // Act
            bool actual = challenger.CountOfElementsIsEven(strings);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#4
0
        public void SumEvens(int[] numbers, int expected)
        {
            // Arrange
            ChallengeSet02 challenger = new ChallengeSet02();

            // Act
            int actual = challenger.SumEvens(numbers);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#5
0
        // [InlineData(null, "", 3)] // Assumption: string will not be null
        public void GetLengthOfShortestString(string str1, string str2, int expected)
        {
            // Arrange
            ChallengeSet02 challenger = new ChallengeSet02();

            // Act
            int actual = challenger.GetLengthOfShortestString(str1, str2);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#6
0
        public void SumOfMinAndMax(IEnumerable <double> numbers, double expected)
        {
            // Arrange
            ChallengeSet02 challenger = new ChallengeSet02();

            // Act
            double actual = challenger.SumOfMinAndMax(numbers);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#7
0
        public void IsSumOdd(int[] numbers, bool expected)
        {
            // Arrange
            ChallengeSet02 challenger  = new ChallengeSet02();
            List <int>     numbersList = numbers == null ? null : new List <int>(numbers);

            // Act
            bool actual = challenger.IsSumOdd(numbersList);

            // Assert
            Assert.Equal(expected, actual);
        }
示例#8
0
        public void CharacterIsNotALetter()
        {
            // Arrange
            ChallengeSet02 challenger = new ChallengeSet02();
            string         nonLetters = "0123456789`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?\u2222";

            // Check all letters
            foreach (char letter in nonLetters)
            {
                // Act
                bool actual = challenger.CharacterIsALetter(letter);

                // Assert
                Assert.False(actual);
            }
        }
示例#9
0
        public void CharacterIsALetter()
        {
            // Arrange
            ChallengeSet02 challenger        = new ChallengeSet02();
            string         lowercaseAlphabet = "abcdefghijklmnopqrstuvwxyz";

            // Check all letters
            foreach (char letter in lowercaseAlphabet)
            {
                // Act
                bool lowercaseActual = challenger.CharacterIsALetter(letter);
                bool uppercaseActual = challenger.CharacterIsALetter(char.ToUpper(letter));

                // Assert
                Assert.True(lowercaseActual);
                Assert.True(uppercaseActual);
            }
        }