public void POCO_Validation_Valid()
 {
     Tested3 tObj = new Tested3();
     IRule rule = CommonPropRules.NotEmptyStringValidation("StringProp");
     tObj.StringProp = "Test";
     Assert.False(rule.IsBroken(tObj));
 }
        public void MaxStringLength(string a, string b, string c, string d, string e, string f, string g)
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.MaxStringLengthValidation("StringProp", 2);

            tObj.StringProp = a;
            Assert.False(rule.IsBroken(tObj));

            tObj.StringProp = b;
            Assert.False(rule.IsBroken(tObj));

            tObj.StringProp = c;
            Assert.False(rule.IsBroken(tObj));

            tObj.StringProp = d;
            Assert.False(rule.IsBroken(tObj));

            tObj.StringProp = e;
            Assert.False(rule.IsBroken(tObj));

            tObj.StringProp = f;
            Assert.True(rule.IsBroken(tObj));

            tObj.StringProp = g;
            Assert.False(rule.IsBroken(tObj));
        }
        public void BetweenValidation_Nullabe()
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.BetweenValidation("IntNullableProp", 1, 3);

            tObj.IntNullableProp = null;
            Assert.True(rule.IsBroken(tObj));

            tObj.IntNullableProp = 0;
            Assert.True(rule.IsBroken(tObj));

            tObj.IntNullableProp = 1;
            Assert.False(rule.IsBroken(tObj));

            tObj.IntNullableProp = 2;
            Assert.False(rule.IsBroken(tObj));

            tObj.IntNullableProp = 3;
            Assert.False(rule.IsBroken(tObj));

            tObj.IntNullableProp = 4;
            Assert.True(rule.IsBroken(tObj));

            rule = CommonPropRules.BetweenValidation("IntNullableProp", null, null);
            tObj.IntNullableProp = 1;
            Assert.True(rule.IsBroken(tObj));
        }
        public void POCO_Validation(string val)
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.NotEmptyStringValidation("StringProp");

            tObj.StringProp = val;
            Assert.True(rule.IsBroken(tObj));
        }
        public void NotNothing_Ref()
        {
            Tested2 value = null;
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.NotNothingValidation("RefProp");

            Assert.True(rule.IsBroken(tObj));

            value = new Tested2();
            Assert.True(rule.IsBroken(tObj));
        }
        public void NotNothingRule_Nullabe(int? a, int? b)
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.NotNothingValidation("IntNullableProp");

            tObj.IntNullableProp = a;
            Assert.True(rule.IsBroken(tObj));

            tObj.IntNullableProp = b;
            Assert.False(rule.IsBroken(tObj));
        }
        public void NotNothingRule_String(string a, string b)
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.NotNothingValidation("StringProp");

            tObj.StringProp = a;
            Assert.True(rule.IsBroken(tObj));

            tObj.StringProp = b;
            Assert.False(rule.IsBroken(tObj));
        }
        public void POCO_ValidationMultipleTests(string a, string b, string c, string d)
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.NotEmptyStringValidation("StringProp");

            tObj.StringProp = a;
            Assert.True(rule.IsBroken(tObj));

            tObj.StringProp = b;
            Assert.True(rule.IsBroken(tObj));

            tObj.StringProp = c;
            Assert.True(rule.IsBroken(tObj));

            tObj.StringProp = d;
            Assert.False(rule.IsBroken(tObj));
        }
        public void DateNotMinValidation()
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.DateNotMinValidation("DateProp");

            Assert.True(rule.IsBroken(tObj));

            tObj.DateProp = null;
            Assert.True(rule.IsBroken(tObj));

            tObj.DateProp = DateTime.MinValue;
            Assert.True(rule.IsBroken(tObj));

            tObj.DateProp = DateTime.MinValue.AddMilliseconds(1);
            Assert.False(rule.IsBroken(tObj));

            tObj.DateProp = DateTime.Now;
            Assert.False(rule.IsBroken(tObj));

            tObj.DateProp = DateTime.MaxValue;
            Assert.False(rule.IsBroken(tObj));
        }
        public void LessThanOrEqual_Nullabe(int? a, int? b, int? c, int? d, int? e)
        {
            Tested3 tObj = new Tested3();
            IRule rule = CommonPropRules.LessThanOrEqualToValidation("IntNullableProp", 1);

            tObj.IntNullableProp = a;
            Assert.True(rule.IsBroken(tObj));

            tObj.IntNullableProp = b;
            Assert.False(rule.IsBroken(tObj));

            tObj.IntNullableProp = c;
            Assert.False(rule.IsBroken(tObj));

            tObj.IntNullableProp = d;
            Assert.False(rule.IsBroken(tObj));

            tObj.IntNullableProp = e;
            Assert.True(rule.IsBroken(tObj));

            rule = CommonPropRules.LessThanValidation("IntNullableProp", null);
            tObj.IntNullableProp = a;
            Assert.True(rule.IsBroken(tObj));
        }