public void An_unentered_scope_still_passes_evaluationsd_to_parent_scope() { var rule = Validate.That <bool>(f => false).WithErrorMessage("oops"); ValidationReport report; using (var parent = new ValidationScope()) { var child = new ValidationScope(false); rule.Check(false, child); report = ValidationReport.FromScope(parent); } Assert.That(report.Failures.Count(f => f.Message == "oops"), Is.EqualTo(1)); }
public void When_adding_parameters_to_disposed_scope_they_are_not_added_to_the_parent() { var rule = Validate.That <bool>(f => false).WithErrorMessage("oops"); ValidationReport report; using (var parent = new ValidationScope()) { var child = new ValidationScope(false); child.Dispose(); rule.Check(false, child); report = ValidationReport.FromScope(parent); } Assert.That(report.Failures.Count(f => f.Message == "oops"), Is.EqualTo(0)); }