Пример #1
0
        public void RubberStamp_Conditions_CustomPropertyCondition_SetMessage_Test()
        {
            var condition = new CustomPropertyCondition <TestClass, int>(c => c.Index, (c, p) => p > 0)
                            .SetMessage("Error message");

            Assert.AreEqual("Error message", condition.Message);
        }
Пример #2
0
        public void RubberStamp_Conditions_CustomPropertyCondition_String_Valid_Test()
        {
            var condition = new CustomPropertyCondition <TestClass, string>(c => c.Name, (c, p) => p != null);

            Assert.IsTrue(condition.IsValid(new TestClass {
                Name = "TEST"
            }));
        }
Пример #3
0
        public void RubberStamp_Conditions_CustomPropertyCondition_Int_Invalid_Test()
        {
            var condition = new CustomPropertyCondition <TestClass, int>(c => c.Index, (c, p) => p > 0);

            Assert.IsFalse(condition.IsValid(new TestClass {
                Index = 0
            }));
        }
Пример #4
0
        public void RubberStamp_Conditions_CustomPropertyCondition_String_Message_Test()
        {
            var condition = new CustomPropertyCondition <TestClass, int>(c => c.Index, (c, p) => p > 0);

            Assert.AreEqual("The Property Index caused a validation error", condition.Message);
        }
Пример #5
0
        public void RubberStamp_Conditions_CustomPropertyCondition_Int_Message_Test()
        {
            var condition = new CustomPropertyCondition <TestClass, string>(c => c.Name, (c, p) => p != null);

            Assert.AreEqual("The Property Name caused a validation error", condition.Message);
        }