Пример #1
0
        public void TestDivideWithDivideByZeroException()
        {
            ExceptionHandlingCase exceptionHandlingCase = new ExceptionHandlingCase();
            int numerator   = 4;
            int denominator = 0;
            int actualResult;

            actualResult = exceptionHandlingCase.Divide(numerator, denominator);
        }
Пример #2
0
        public void TestDivide()
        {
            try
            {
                ExceptionHandlingCase exceptionHandlingCase = new ExceptionHandlingCase();
                int numerator   = 4;
                int denominator = 0;
                int actualResult;

                //Act
                actualResult = exceptionHandlingCase.Divide(numerator, denominator); // this will throw DivideByZeroException
            }
            catch (Exception e)
            {
                //Assert
                throw new AssertFailedException(e.Message, e);
            }
        }