public void TestDivideWithDivideByZeroException() { ExceptionHandlingCase exceptionHandlingCase = new ExceptionHandlingCase(); int numerator = 4; int denominator = 0; int actualResult; actualResult = exceptionHandlingCase.Divide(numerator, denominator); }
public void TestSmallestWithNullReferenceException() { ExceptionHandlingCase exceptionHandlingCase = new ExceptionHandlingCase(); int[] arr = null; //Act int actualValue = exceptionHandlingCase.Smallest(arr); }
public void TestSmallestWithSizeZero() { ExceptionHandlingCase exceptionHandlingCase = new ExceptionHandlingCase(); int[] arr = { 12 }; int expectedValue = 12; //Act int actualValue = exceptionHandlingCase.Smallest(arr); //Assert Assert.AreEqual(expectedValue, actualValue); }
public void TestSmallest() { ExceptionHandlingCase exceptionHandlingCase = new ExceptionHandlingCase(); int[] arr = { 12, 6, 8, 1, 7, 9, 23 }; int expectedValue = 1; //Act int actualValue = exceptionHandlingCase.Smallest(arr); //Assert Assert.AreEqual(expectedValue, actualValue); }
public void TestSmallestWithNullValue() { try { ExceptionHandlingCase exceptionHandlingCase = new ExceptionHandlingCase(); int[] arr = null; //Act int actualValue = exceptionHandlingCase.Smallest(arr); } catch (Exception e) { //Assert throw new AssertFailedException(e.Message, e); } }
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); } }