예제 #1
0
        public void TestValidation()
        {
            AttributeType type = new AttributeType("test", typeof(string));
            AttributeInfo test = new AttributeInfo("test", type);

            CollectionAssert.IsEmpty(test.Rules);

            var rule = new SimpleAttributeRule();

            test.AddRule(rule);

            Utilities.TestSequenceEqual(test.Rules, rule);

            Assert.True(test.Validate("bar"));
            Assert.True(rule.Validated);

            Assert.False(test.Validate(1)); // wrong type
        }