public void GivenNegativeValue_WhenCallNumberOfSteps_ThenShouldThrowException(int num, int expected)
        {
            var sut = new NumberOfStepsToReduceANumberToZero();
            var ex  = Assert.Throws <ArgumentException>(() => sut.NumberOfSteps(num));

            Assert.That(ex.Message, Is.EqualTo(Messages.InvalidInput));
        }
        public void GivenPositiveValue_WhenCallNumberOfSteps_ThenShouldReturnNumberOfSteps(int num, int expected)
        {
            var sut    = new NumberOfStepsToReduceANumberToZero();
            var actual = sut.NumberOfSteps(num);

            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void NumberOfStepsToReduceANumberToZeroTest(int num, int expected)
        {
            var numberOfStepsToReduceANumberToZero = new NumberOfStepsToReduceANumberToZero();

            var actual = numberOfStepsToReduceANumberToZero.NumberOfSteps(num);

            Assert.That(actual, Is.EqualTo(expected));
        }
コード例 #4
0
        public void Test(int num, int expected)
        {
            var obj = new NumberOfStepsToReduceANumberToZero();

            var rslt = obj.NumberOfSteps(num);

            Assert.Equal(expected, rslt);
        }