コード例 #1
0
        public void GetSmallestNumber(int number1, int number2, int expected)
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            int actual = challenger.GetSmallestNumber(number1, number2);

            // Assert
            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void Subtract(double minuend, double subtrahend, double expectedDifference)
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            double actual = challenger.Subtract(minuend, subtrahend);

            // Assert
            Assert.Equal(Math.Round(expectedDifference, 2), Math.Round(actual, 2));
        }
コード例 #3
0
        public void Add(int addend1, int addend2, int expectedSum)
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            int actual = challenger.Add(addend1, addend2);

            // Assert
            Assert.Equal(expectedSum, actual);
        }
コード例 #4
0
        public void AreTwoNumbersTheSame(int number1, int number2, bool expected)
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            bool actual = challenger.AreTwoNumbersTheSame(number1, number2);

            // Assert
            Assert.Equal(expected, actual);
        }
コード例 #5
0
        public void GetHey()
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            string actual = challenger.GetHey();

            // Assert
            Assert.Equal("HEY!", actual);
        }
コード例 #6
0
        // [InlineData(null, "Hello!")] // Assumption: string will not be null
        public void GetGreeting(string personName, string expectedGreeting)
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            string actual = challenger.GetGreeting(personName);

            // Assert
            Assert.Equal(expectedGreeting, actual);
        }
コード例 #7
0
        public void Multiply(long factor1, long factor2, long product)
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            long actual = challenger.Multiply(factor1, factor2);

            // Assert
            Assert.Equal(product, actual);
        }
        // [InlineData(null, "Hello!")] // Assumption: string will not be null
        public void GetGreeting(string personName, string expectedGreeting) //ChallengesWithTest01.cs string was named nameOfPerson
        {
            // Arrange
            ChallengesSet01 challenger = new ChallengesSet01();

            // Act
            string actual = challenger.GetGreeting(personName);

            // Assert
            Assert.Equal(expectedGreeting, actual);
        }