コード例 #1
0
        public void ValidationLoader_AttributeTest_Invalid()
        {
            var obj = new DomainObject17();

            obj.ID = -5;
            var result = ValidationHandler.Validate(obj);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.FirstOrDefault(x => x.MemberNames.Any(y => y == "ID")));
        }
コード例 #2
0
        public void ValidationLoader_AttributeTest_Valid()
        {
            var obj = new DomainObject17();

            obj.ID = 5;
            var r   = ValidationHandler.Validate(obj);
            var sum = ValidationSummary.Map(r);

            Assert.IsNull(r, "Validation Object returned not null for model with validation attributes");
            Assert.IsNotNull(sum.Errors.Count == 0);
        }