public async Task TestAreaofCircleTrue(int r, double expectedResult) { BL.Test2 question2BL = new BL.Test2(); // Act var result = await question2BL.AreaofCircle(r); // Assert Assert.AreEqual(result, expectedResult); }
public void TestGetValuebyIndex(int[] intArray, int index, int expectedResult) { BL.Test2 question2BL = new BL.Test2(); // Act int result = question2BL.GetValuebyIndex(intArray, index); // Assert Assert.That(result == expectedResult); }
public void TestGetValuebyIndexException() { BL.Test2 question2BL = new BL.Test2(); // Act var result = Assert.Throws <IndexOutOfRangeException>(() => question2BL.GetValuebyIndex(new int[] { 1, 2, 3 }, 4)).Message; // Assert Assert.AreEqual("Index was outside the bounds of the array.", result); }
public async Task TestDivision(int num1, int num2, double expectedResult) { BL.Test2 question2BL = new BL.Test2(); // Act double result = await question2BL.Division(num1, num2); // Assert Assert.AreEqual(result, expectedResult); }
public async Task TestPerimeterofSquareFalse(int l, double expectedResult) { BL.Test2 question2BL = new BL.Test2(); // Act var result = await question2BL.PerimeterofSquare(l); // Assert Assert.AreNotEqual(result, expectedResult); }
public void TestDivisionException() { BL.Test2 question2BL = new BL.Test2(); // Act var result = Assert.ThrowsAsync <DivideByZeroException>(async() => await question2BL.Division(10, 0)).Message; // Assert Assert.AreEqual("Attempted to divide by zero.", result); }