public void ShouldThrow_Exception(int[] array1, int[] array2) { //Assert.Throws(typeof(Exception), () => ArrayTools.CountDifference(array1, array2)); //without message Assert.Throws <Exception>(() => ArrayTools.CountDifference(array1, array2)); //also without message choose this or the line above //Assert.Throws(Is.TypeOf<Exception>().And.Message.EqualTo("Arrays are not the same length"), () => ArrayTools.CountDifference(array1, array2)); //with message }
public void Test_Difference_Count(int[] array1, int[] array2, int result) { Assert.AreEqual(result, ArrayTools.CountDifference(array1, array2)); }