public void SimpleInterfaceTest() { var builder = new Fluent.FluentBuilder(); builder.For<IMyClass>() .Setup(m => m.A) .MustBeGreaterThan(0); var engine = builder.Build(); var report = new TestingValidationReport(engine); var o1 = new MyClass(0); Assert.IsFalse(report.Validate(o1)); Assert.AreEqual(1, report.Errors.Length); report.AssertError<IMyClass, int>(o1, p1 => p1.A, RuleKinds.GreaterThanRule, 0); var o2 = new MyClassExplicit(0); Assert.IsFalse(report.Validate(o2)); Assert.AreEqual(1, report.Errors.Length); report.AssertError<IMyClass, int>(o2, p1 => p1.A, RuleKinds.GreaterThanRule, 0); }
public void SimpleInterfaceTest() { var engine = new Engine(); engine.For <IMyClass>() .Setup(m => m.A) .MustBeGreaterThan(0); var report = new TestingValidationReport(engine); var o1 = new MyClass(0); Assert.IsFalse(report.Validate(o1)); Assert.AreEqual(1, report.Errors.Length); report.AssertError <IMyClass, int>(o1, p1 => p1.A, RuleKinds.GreaterThanRule, 0); var o2 = new MyClassExplicit(0); Assert.IsFalse(report.Validate(o2)); Assert.AreEqual(1, report.Errors.Length); report.AssertError <IMyClass, int>(o2, p1 => p1.A, RuleKinds.GreaterThanRule, 0); }