public void TestIfCanRecursivelyDoAFailingAssertion() { // Arrange var parent = new Parent(); var member = new Child(); parent.Child = member; member.Data = "test"; Exception expected = null; // Act try { Verify.That(parent) .Member(parent.Child) (child => child.Member( c => c.Data) (data => data.IsEqualTo("wrong"))) .Now(); } catch (Exception ex) { expected = ex; } // Assert Assert.IsNotNull(expected); }
public void TestIfCanRecursivelyDoATrueAssertion() { // Arrange var parent = new Parent(); var member = new Child(); parent.Child = member; member.Data = "test"; // Act Verify.That(parent) .Member(parent.Child) (Child => Child.IsNotNull() .And() .Member(c => c.Data) (Data => Data.IsEqualTo("test"))) .Now(); // Assert Assert.IsTrue(true); }
public void TestIfCanVerifyAFailingAssertionOfAMemberFuncOfAnObject() { // Arrange var parent = new Parent(); var member = new Child(); parent.Child = member; Exception expected = null; // Act try { Verify.That(parent) .Member(() => parent.Child) (child => child.IsNull()) .Now(); } catch (Exception ex) { expected = ex; } // Assert Assert.IsNotNull(expected); }
public void TestIfCanVerifyATrueAssertionOfAMemberOfAnObject() { // Arrange var parent = new Parent(); var member = new Child(); parent.Child = member; // Act Verify.That(parent) .Member(parent.Child) (child => child.IsNotNull()) .Now(); // Assert Assert.IsTrue(true); }