Пример #1
0
        public void TestMinSizeFieldWithMinError()
        {
            var model = new TestModels.MaxMinSizeFieldModel
            {
                MaxMinField = "1"
            };

            Engine.Validate(model);

            var result = Engine.Error.Single(q => q.Key.Name == "MaxMinField").Value.Contains(ValidationAttribute.ErrorCode.IsBetweenMinMaxSizeError.ToString());

            Assert.IsTrue(result);
        }
Пример #2
0
        public void TestMinSizeFieldPassed()
        {
            var model = new TestModels.MaxMinSizeFieldModel
            {
                MinField = "Supercalifragilisticexpialidocious"
            };

            Engine.Validate(model);

            var result = Engine.Error.Single(q => q.Key.Name == "MinField").Value.Contains(ValidationAttribute.ErrorCode.IsBetweenMinMaxSizeError.ToString());

            Assert.IsFalse(result);
        }
        public void TestMaxSizeFieldPassed()
        {
            var model = new TestModels.MaxMinSizeFieldModel
            {
                MaxField = "Super"
            };

            Engine.Validate(model);

            var result = Engine.Error.Single(q => q.Key.Name == "MaxField").Value.Contains(ValidationAttribute.ErrorCode.IsBetweenMinMaxSizeError.ToString());

            Assert.IsFalse(result);
        }
        public void TestMaxSizeFieldWithError()
        {
            var model = new TestModels.MaxMinSizeFieldModel
            {
                MaxField = "Supercalifragilisticexpialidocious"
            };

            Engine.Validate(model);

            var result = Engine.Error.Single(q => q.Key.Name == "MaxField").Value.Contains(ValidationAttribute.ErrorCode.IsBetweenMinMaxSizeError.ToString());

            Assert.IsTrue(result);
        }
        public void TestMinSizeFieldWithMaxError()
        {
            var model = new TestModels.MaxMinSizeFieldModel
            {
                MaxMinField = "1234567890ABCDEF"
            };

            Engine.Validate(model);

            var result = Engine.Error.Single(q => q.Key.Name == "MaxMinField").Value.Contains(ValidationAttribute.ErrorCode.IsBetweenMinMaxSizeError.ToString());

            Assert.IsTrue(result);
        }