public void CreateValueLookup_returns_a_lambda_that_gets_the_property_value() { var propertyLookupLambda = SimpleDataLookup.CreateValueLookup ("foo bar"); var dataSourceObject = new ClassWithHiddenProperties () { Year = 9001 }; Assert.AreEqual (dataSourceObject.Year, propertyLookupLambda (dataSourceObject)); }
public void CreateValueLookup_returns_a_lambda_that_returns_the_value_of_a_field() { var propertyLookupLambda = SimpleDataLookup.CreateValueLookup("Goo"); var dataSourceObject = new ClassWithHiddenProperties(); Assert.AreEqual (dataSourceObject.Goo, propertyLookupLambda(dataSourceObject)); }
public void CreateValueLookup_returns_a_lambda_that_returns_the_value_of_a_method() { var propertyLookupLambda = SimpleDataLookup.CreateValueLookup("SomeFunction"); var dataSourceObject = new ClassWithHiddenProperties(); Assert.AreEqual (dataSourceObject.SomeFunction(), propertyLookupLambda(dataSourceObject)); }
public void CreateValueLookup_returns_a_lambda_that_gets_the_submember_value() { var propertyLookupLambda = SimpleDataLookup.CreateValueLookup ("BoundByName"); var dataSourceObject = new ClassWithHiddenProperties () { BoundByName = new ClassWithHiddenProperties() { Title = "IT'S OVER 9000!" } }; Assert.AreEqual (dataSourceObject.BoundByName.Title, propertyLookupLambda (dataSourceObject)); }