In C#you can catch the exception in the default test suite, like this:
[TestMethod]
[ExpectedException(typeof (ArgumentNullException))]
public void TestNullComposite()
{
IApi api = new Api();
api.GetDataUsingDataContract(null);
}
But when you analyze the code coverage, it says that you get only 66.67% of the coverage because the last curly bracket was not covered.
How can I achieve 100% coverage of this unit test?
source
share