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 PropertyValue_Tests() { Tested1 tobj1 = new Tested1() { StringProp = "Test Value" }; PropertyValidationRule<string, string> tObj = new PropertyValidationRule<string, string>("TestRuleName", "TestDescription", "StringProp"); Assert.Equal("Test Value", tObj.PropertyValue(tobj1)); Assert.Equal("Tests2 Value", tObj.PropertyValue(new Tested2())); Assert.Null(tObj.PropertyValue(new Tested3())); }
public void GuidEmptyValidation_NotBroke() { Tested1 validated = new Tested1() { GuidProp = Guid.Empty }; IRule tObj = CommonPropRules.GuidEmpty("GuidProp"); Assert.False(tObj.IsBroken(validated)); }
public void GuidEmptyValidation_Broke() { Tested1 validated = new Tested1() { GuidProp = Guid.NewGuid() }; IRule tObj = CommonPropRules.GuidEmpty("GuidProp"); Assert.True(tObj.IsBroken(validated)); }
public void NotEmptyGuidValidation_Broke() { Tested1 validated = new Tested1(); IRule tObj = CommonPropRules.GuidNotEmpty("GuidProp"); Assert.True(tObj.IsBroken(validated)); }
public void NotEmptyStringValidation_NotBroke() { Tested1 validated = new Tested1() { StringProp = "Test" }; IRule tObj = CommonPropRules.NotEmptyStringValidation("StringProp"); Assert.False(tObj.IsBroken(validated)); }
public void NotEmptyStringValidation_Broke() { Tested1 validated = new Tested1(); IRule tObj = CommonPropRules.NotEmptyStringValidation("StringProp"); Assert.True(tObj.IsBroken(validated)); }