public void GreaterThan_NotBroke() { Tested1 validated = new Tested1() { IntProp = 2 }; Tested1 val2 = new Tested1() { IntProp = 0 }; IRule tObj = CommonPropRules.GreaterThanValidation("IntProp", 1); Assert.False(tObj.IsBroken(validated)); Assert.True(tObj.IsBroken(val2)); }
public void GreaterThan_Nullabe(int? a, int? b, int? c, int? d, int? e) { Tested3 tObj = new Tested3(); IRule rule = CommonPropRules.GreaterThanValidation("IntNullableProp", 1); tObj.IntNullableProp = a; Assert.True(rule.IsBroken(tObj)); tObj.IntNullableProp = b; Assert.True(rule.IsBroken(tObj)); tObj.IntNullableProp = c; Assert.True(rule.IsBroken(tObj)); tObj.IntNullableProp = d; Assert.True(rule.IsBroken(tObj)); tObj.IntNullableProp = e; Assert.False(rule.IsBroken(tObj)); rule = CommonPropRules.GreaterThanValidation("IntNullableProp", null); tObj.IntNullableProp = a; Assert.True(rule.IsBroken(tObj)); }