public void CustomAssert_ShouldAssertInOrderOfInvocation_WithInvoke() { // Arrange string expected1 = "expected1"; string expected2 = "expected2"; MockMethodWithParam <string> subject = new MockMethodWithParam <string>("methodName"); subject.UpdateInvocation(); subject.Invoke(expected1); subject.Invoke(expected2); // Act Action actual = () => subject.AssertCustom(o => o.Equals(expected1).Should().BeTrue()); Action actual2 = () => subject.AssertCustom(o => o.Equals(expected2).Should().BeTrue()); // Assert actual.Should().NotThrow(); actual2.Should().NotThrow(); }
public void AssertCustom_ShouldNotThrowWhenTrue_WithInvoke() { // Arrange MockMethodWithParam <string> subject = new MockMethodWithParam <string>("methodName"); subject.UpdateInvocation(); subject.Invoke("expected"); // Act Action actual = () => subject.AssertCustom(o => o.Equals("expected").Should().BeTrue()); // Assert actual.Should().NotThrow(); }
public void AssertCustom_ShouldThrowWhenFalse_WithInvoke() { // Arrange MockMethodWithParam <string> subject = new MockMethodWithParam <string>("methodName"); subject.UpdateInvocation(); subject.Invoke("Not expected"); // Act Action actual = () => subject.AssertCustom(o => o.Equals("expected").Should().BeTrue("this is expected to throw")); // Assert actual.Should().Throw <Exception>(); }