Exemple #1
0
        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));
        }
Exemple #2
0
        public void Initialization()
        {
            var attribute = new LinqPropertyRedirectionAttribute(typeof(Order), "OrderNumber");

            var expected = Is.EqualTo(typeof(Order).GetProperty("OrderNumber"));

            Assert.That(attribute.GetMappedProperty(), expected);
        }
Exemple #3
0
        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")));
        }
Exemple #4
0
        public void GetTransformer_NonExistingProperty()
        {
            var attribute = new LinqPropertyRedirectionAttribute(typeof(Order), "Hugo");

            attribute.GetExpressionTransformer(null);
        }