예제 #1
0
        public void canAddException()
        {
            int    resultMax = 10;
            int    valMax    = 4;
            Abacus abacus    = new Abacus(valMax, resultMax);
            //Assert.Equal(7, abacus.Add(5, 2));

            Exception ex = Assert.Throws <ValidationException>(() => abacus.Add(3, 8));

            Assert.Equal(string.Format("value must be less than or equal to {0}.", valMax), ex.Message);
        }
예제 #2
0
        public void canAddNumbersFromInlineDataInput2(int x, int y)
        {
            //arrange
            Abacus abacus = new Abacus(Math.Max(x, y), x + y);

            Console.WriteLine("value :" + Math.Max(x, y));
            //act
            int result = abacus.Add(x, y);

            //assert
            Assert.True(result > 0);
            Assert.Equal(x + y, result);
        }
예제 #3
0
        public void canAddNumbersFromInlineDataInput(int x, int y)
        {
            //arrange :Prepare for the test
            Abacus abacus = new Abacus(Math.Max(x, y), x + y);

            Console.WriteLine("value :" + Math.Max(x, y));
            //act : Run the SUT(System Under Test)
            int result = abacus.Add(x, y);

            //assert : Check et verify the result
            Assert.True(result > 0);
            Assert.Equal(x + y, result);
        }
예제 #4
0
        public void canAddToResultLimit()
        {
            Abacus abacus = new Abacus(2, 4);

            Assert.Equal(4, abacus.Add(5, 2));
        }
예제 #5
0
        public void canAddOnePlusOne()
        {
            Abacus abacus = new Abacus(2, 4);

            Assert.Equal(2, abacus.Add(1, 1));
        }