Using MSTest how can I verify the exact error message coming from a test method? I know [ExpectedException(typeof(ApplicationException), error msg)] doesn\'t co
MSTest v2 supports Assert.Throws and Assert.ThrowsAsync which returns the captured exception.
Here is an article on how to upgrade to MSTest v2: https://blogs.msdn.microsoft.com/devops/2017/09/01/upgrade-to-mstest-v2/
Here is example usage:
var myObject = new MyObject();
var ex = Assert.Throws(() => myObject.Do(null));
StringAssert.Contains(ex.Message, "Parameter name: myArg");