コード例 #1
0
 public void Test()
 {
     Utilities.Validation.Rules.DoesNotContain<ClassC, string> TestObject = new DoesNotContain<ClassC, string>(x => x.ItemA, "A", "Error");
     ClassC Temp = new ClassC();
     Temp.ItemA = new List<string>();
     Temp.ItemA.Add("A");
     Temp.ItemA.Add("B");
     Assert.Throws<NotValid>(() => TestObject.Validate(Temp));
     Temp.ItemA.Clear();
     Temp.ItemA.Add("B");
     Assert.DoesNotThrow<Exception>(() => TestObject.Validate(Temp));
 }
コード例 #2
0
        public void Test()
        {
            Utilities.Validation.Rules.DoesNotContain <ClassC, string> TestObject = new DoesNotContain <ClassC, string>(x => x.ItemA, "A", "Error");
            ClassC Temp = new ClassC();

            Temp.ItemA = new List <string>();
            Temp.ItemA.Add("A");
            Temp.ItemA.Add("B");
            Assert.Throws <NotValid>(() => TestObject.Validate(Temp));
            Temp.ItemA.Clear();
            Temp.ItemA.Add("B");
            Assert.DoesNotThrow(() => TestObject.Validate(Temp));
        }