public void TestByIdentifierEmpty() { ValidationTestList <SampleObject> list = new ValidationTestList <SampleObject>(); list.Add(new ValidationTest <SampleObject, string>(x => x.Length > 4, Reflect.Member <SampleObject>(x => x.PropertyOne), "Foo")); list.Add(new ValidationTest <SampleObject, string>(x => x.Length < 10, Reflect.Member <SampleObject>(x => x.PropertyOne), "Bar")); list.Add(new ValidationTest <SampleObject, int>(x => x != 3, Reflect.Member <SampleObject>(x => x.PropertyTwo), "Bar")); ValidationTestList <SampleObject> subset = list.ByIdentifier("Spong"); Assert.AreEqual(0, subset.Count, "Correct count"); }
public void TestByIdentifierAndMember() { ValidationTestList <SampleObject> list = new ValidationTestList <SampleObject>(); list.Add(new ValidationTest <SampleObject, string>(x => x.Length > 4, Reflect.Member <SampleObject>(x => x.PropertyOne), "Foo")); list.Add(new ValidationTest <SampleObject, string>(x => x.Length < 10, Reflect.Member <SampleObject>(x => x.PropertyOne), "Bar")); list.Add(new ValidationTest <SampleObject, int>(x => x != 3, Reflect.Member <SampleObject>(x => x.PropertyTwo), "Bar")); ValidationTestList <SampleObject> subset = list.ByIdentifier("Bar", x => x.PropertyOne); Assert.AreEqual(1, subset.Count, "Correct count"); Assert.AreEqual("Bar", subset[0].Identifier, "Correct identifier"); Assert.AreEqual("PropertyOne", subset[0].Member.Name, "Correct member name"); }