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); }