Пример #1
0
        public void TestProperties_PropertyWithName_HasNoError()
        {
            var property  = new Properties("asdf");
            var testClass = new TestClass(new[] { property });

            var validator = new TestClassValidator();

            validator.ShouldNotHaveValidationErrorFor(x => x.TestProperties, testClass);
        }
Пример #2
0
        public void TestProperties_PropertyWithNullName_HasCustomError()
        {
            var property  = new Properties(null);
            var testClass = new TestClass(new[] { property });

            var validator = new TestClassValidator();

            validator.ShouldHaveValidationErrorFor(x => x.TestProperties, testClass).WithErrorMessage($"TestProperty {property.Id} name can't be null or empty");
        }