Mid Testing

How do you assert expected exceptions in MSTest?

[TestMethod]

[ExpectedException(typeof(DivideByZeroException))]

public void Divide_ByZero_ThrowsException()

var calculator = new Calculator();

calculator.Divide(10, 0);

More from C# Programming Tutorial

All questions for this course