public void Deferred_reportable_values_should_not_be_calculated_in_absence_of_failures() { // Arrange var scope = new AssertionScope(); var deferredValueInvoked = false; scope.AddReportable("MyKey", () => { deferredValueInvoked = true; return("MyValue"); }); // Act scope.Dispose(); // Assert deferredValueInvoked.Should().BeFalse(); }
public void When_the_previous_assertion_failed_it_should_not_execute_the_succeeding_failure() { // Arrange using var scope = new AssertionScope(); // Act Execute.Assertion .ForCondition(false) .FailWith("First assertion") .Then .ForCondition(false) .FailWith("Second assertion"); string[] failures = scope.Discard(); scope.Dispose(); Assert.Single(failures); Assert.Contains("First assertion", failures); }
public void When_using_a_deferred_reportable_value_it_is_not_calculated_if_there_are_no_failures() { // Arrange var scope = new AssertionScope(); var deferredValueInvoked = false; scope.AddReportable("MyKey", () => { deferredValueInvoked = true; return("MyValue"); }); // Act scope.Dispose(); // Assert deferredValueInvoked.Should().BeFalse(); }