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)); }
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)); }