public void ShouldWorkForIsInstanceOfType() { var sut = new SutClass(2, 42); var expected = new { TheProperty = 12 }; Check.That(sut).Considering().Public.Properties.IsInstanceOfType(expected.GetType()); Check.That(expected).Considering().Public.Properties.IsInstanceOfType(sut.GetType()); }
public void NotShouldWorkWhenMissingMember() { var sut = new SutClass(2, 42); var expected = new { TheProperty = 12, Test = 11 }; Check.That(sut).Considering().Public.Properties.IsNoInstanceOfType(expected.GetType()); Check.That(expected).Considering().Public.Properties.IsNoInstanceOfType(sut.GetType()); }
public void FailWhenMissingMember() { var sut = new SutClass(2, 42); var expected = new { TheProperty = 12, Test = 11 }; Check.ThatCode(() => { Check.That(sut).Considering().Public.Properties.IsInstanceOfType(expected.GetType()); }).IsAFailingCheckWithMessage("", "The expected value's property 'Test' is absent from the checked one.", "The expected value's property 'Test':", "\t[null]"); Check.ThatCode(() => { Check.That(expected).Considering().Public.Properties.IsInstanceOfType(sut.GetType()); }).IsAFailingCheckWithMessage("", "The checked value's property 'Test' is absent from the expected one.", "The checked value's property 'Test':", "\t[11]"); }