public void TheAssertionIsLoggedAndCapturedButExecutionEnds() { StubAssertionFailure failure1 = new StubAssertionFailure(); StubAssertionFailure failure2 = new StubAssertionFailure(); bool completed = false; AssertionFailure[] failures = AssertionContext.CurrentContext.CaptureFailures(delegate { AssertionContext.CurrentContext.SubmitFailure(failure1); AssertionContext.CurrentContext.SubmitFailure(failure2); completed = true; }, AssertionFailureBehavior.LogAndThrow, false); Assert.AreElementsEqual(new[] { failure1 }, failures); Assert.IsTrue(failure1.WasWriteToCalled); Assert.IsFalse(failure2.WasWriteToCalled); Assert.IsFalse(completed); }
public void TheAssertionIsLoggedAndCapturedButExecutionEnds() { StubAssertionFailure failure1 = new StubAssertionFailure(); StubAssertionFailure failure2 = new StubAssertionFailure(); bool completed = false; AssertionFailure[] failures = AssertionContext.CurrentContext.CaptureFailures(delegate { AssertionContext.CurrentContext.SubmitFailure(failure1); AssertionContext.CurrentContext.SubmitFailure(failure2); completed = true; }, AssertionFailureBehavior.LogAndThrow, false); Assert.AreElementsEqual(new[] { failure1 }, failures); Assert.IsTrue(failure1.WasWriteToCalled); Assert.IsFalse(failure2.WasWriteToCalled); Assert.IsFalse(completed); }
public void NothingHappens() { StubAssertionFailure failure1 = new StubAssertionFailure(); StubAssertionFailure failure2 = new StubAssertionFailure(); bool completed = false; AssertionFailure[] failures = AssertionContext.CurrentContext.CaptureFailures(delegate { AssertionContext.CurrentContext.SubmitFailure(failure1); AssertionContext.CurrentContext.SubmitFailure(failure2); completed = true; }, AssertionFailureBehavior.Discard, false); Assert.IsEmpty(failures); Assert.IsFalse(failure1.WasWriteToCalled); Assert.IsFalse(failure2.WasWriteToCalled); Assert.IsTrue(completed); }
public void NothingHappens() { StubAssertionFailure failure1 = new StubAssertionFailure(); StubAssertionFailure failure2 = new StubAssertionFailure(); bool completed = false; AssertionFailure[] failures = AssertionContext.CurrentContext.CaptureFailures(delegate { AssertionContext.CurrentContext.SubmitFailure(failure1); AssertionContext.CurrentContext.SubmitFailure(failure2); completed = true; }, AssertionFailureBehavior.Discard, false); Assert.IsEmpty(failures); Assert.IsFalse(failure1.WasWriteToCalled); Assert.IsFalse(failure2.WasWriteToCalled); Assert.IsTrue(completed); }