public void Initialization_NonPublicProperty() { var attribute = new LinqPropertyRedirectionAttribute(typeof(ClassWithNonPublicProperties), "PrivateGetSet"); var expected = typeof(ClassWithNonPublicProperties).GetProperty("PrivateGetSet", BindingFlags.NonPublic | BindingFlags.Instance); Assert.That(attribute.GetMappedProperty(), Is.EqualTo(expected)); }
public void Initialization() { var attribute = new LinqPropertyRedirectionAttribute(typeof(Order), "OrderNumber"); var expected = Is.EqualTo(typeof(Order).GetProperty("OrderNumber")); Assert.That(attribute.GetMappedProperty(), expected); }
public void GetTransformer() { var attribute = new LinqPropertyRedirectionAttribute(typeof(Order), "OrderNumber"); var transformer = attribute.GetExpressionTransformer(null); Assert.That(transformer, Is.TypeOf(typeof(LinqPropertyRedirectionAttribute.MethodCallTransformer))); Assert.That(((LinqPropertyRedirectionAttribute.MethodCallTransformer)transformer).MappedProperty, Is.SameAs(typeof(Order).GetProperty("OrderNumber"))); }
public void GetTransformer_NonExistingProperty() { var attribute = new LinqPropertyRedirectionAttribute(typeof(Order), "Hugo"); attribute.GetExpressionTransformer(null); }