public void NamedValueExtractorWithInvalidField() { NamedValueExtractor nve; nve = new NamedValueExtractor("xxx"); var test = new ClassTest1(); test.field = 30; Assert.Throws(typeof(ArgumentException), () => nve.ExtractValue(test)); }
public void ExtractFieldByProperty() { NamedValueExtractor nve; nve = new NamedValueExtractor("Property"); var test = new ClassTest1(); test.Property = "StringTest"; Assert.AreEqual(test.Property, nve.ExtractValue(test), "NamedValueExtractor does not dynamically get Property"); }
public void ExtractFieldByName() { NamedValueExtractor nve; nve = new NamedValueExtractor("field"); var test = new ClassTest1(); test.field = 30; Assert.AreEqual(test.field, nve.ExtractValue(test), "NamedValueExtractor does not dynamically get field"); }
public Rule OnMember <T>(Expression <Func <T, Object> > propertySelector) { Extractor = new NamedValueExtractor(propertySelector.GetMemberName()); return(this); }
public Rule OnMember(String propertyName) { Extractor = new NamedValueExtractor(propertyName); return(this); }