public void MatchType_Assert_Decimal_DoesNotMatchType_Error() { MatchType matchType = new MatchType(typeof(int)); var exception = Assert.Throws <Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException>(() => matchType.Assert(_testFramework, 1234.5m, "Custom message")); Assert.AreEqual($"Assert.IsInstanceOfType failed. Custom message does not match the type Expected type:<System.Int32>. Actual type:<System.Decimal>.", exception.Message); }
public void MatchType_Assert_Decimal_MatchesType_NoError() { MatchType matchType = new MatchType(typeof(decimal)); Assert.DoesNotThrow(() => matchType.Assert(_testFramework, 152m, "Custom message")); }
public void MatchType_Assert_DoesNotMatchType_Error(Type expectedType, object value, string expectedMessage) { MatchType matchType = new MatchType(expectedType); var exception = Assert.Throws <Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException>(() => matchType.Assert(_testFramework, value, "Custom message")); Assert.AreEqual($"Assert.IsInstanceOfType failed. Custom message does not match the type {expectedMessage}.", exception.Message); }
public void MatchType_Assert_MatchesType_NoError(Type expectedType, object value) { MatchType matchType = new MatchType(expectedType); Assert.DoesNotThrow(() => matchType.Assert(_testFramework, value, "Custom message")); }