public void NoMatchRegex_AssertString_MatchesRegex_Error() { NoMatchRegex matchRegex = new NoMatchRegex(@"\b[M]\w+"); var exception = Assert.Throws <Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException>(() => matchRegex.Assert(_testFramework, "Mike", "Custom message")); Assert.AreEqual("StringAssert.DoesNotMatch failed. String 'Mike' matches pattern '\\b[M]\\w+'. Custom message matches the regex when it should not match.", exception.Message); }
public void NoMatchRegex_AssertString_DoesNotMatchRegex_NoError() { NoMatchRegex matchRegex = new NoMatchRegex(@"\b[M]\w+"); Assert.DoesNotThrow(() => matchRegex.Assert(_testFramework, "Brian", "Custom message")); }