public void SingleValidationSuccessTest() { var validator = ChainingValidator.CreateSimple <int>(source => source < 10); // valid source validator.Validate(1).IsTrue(); }
public void SingleValidationFailedTest() { var validator = ChainingValidator.CreateSimple <int>(source => source < 10); // invalid source validator.Validate(10).IsFalse(); }
public void MultiValidationTooSmallTest() { var validator = ChainingValidator .CreateSimple <int>(source => source < 10) .Add(source => source >= 0); validator.Validate(-1).IsFalse(); }
public void MultiValidationSuccessTest() { var validator = ChainingValidator .CreateSimple <int>(source => source < 10) .Add(source => source >= 0); validator.Validate(5).IsTrue(); }
public void SimpleEqualsTest() { var expectedPerson = new Person(20, "Taro"); var validator = ChainingValidator.CreateSimple <Person>() .AddEquals(expectedPerson); validator.Validate(new Person(20, "Taro")).IsTrue(); validator.Validate(new Person(19, "Taro")).IsFalse(); validator.Validate(new Person(20, "Taroo")).IsFalse(); }