public void Test() { Utilities.Validation.Rules.LessThan<ClassA, int> TestObject = new LessThan<ClassA, int>(x => x.ItemA, 3, "Error"); ClassA Temp = new ClassA(); Temp.ItemA = 2; Assert.DoesNotThrow(() => TestObject.Validate(Temp)); Temp.ItemA = 3; Assert.Throws<NotValid>(() => TestObject.Validate(Temp)); }