예제 #1
0
        public void DecodeMemberAccessExpressionOfShouldReturnMemberOfRequiredClass()
        {
            var mi1 = TypeExtensions.DecodeMemberAccessExpressionOf <MyClass>(mc => mc.BaseProperty);

            Assert.That(mi1.DeclaringType, Is.EqualTo(typeof(MyBaseClass)));
            Assert.That(mi1.ReflectedType, Is.EqualTo(typeof(MyClass)));

            var mi2 = TypeExtensions.DecodeMemberAccessExpressionOf <MyClass>(mc => mc.BaseBool);

            Assert.That(mi2.DeclaringType, Is.EqualTo(typeof(MyBaseClass)));
            Assert.That(mi2.ReflectedType, Is.EqualTo(typeof(MyClass)));
        }
예제 #2
0
        public void DecodeMemberAccessExpressionOfWithGenericShouldReturnMemberOfRequiredClass()
        {
            var mi1 = TypeExtensions.DecodeMemberAccessExpressionOf <MyEntity>(mc => mc.Id);

            Assert.That(mi1.DeclaringType, Is.EqualTo(typeof(BaseEntity)));
            Assert.That(mi1.ReflectedType, Is.EqualTo(typeof(MyEntity)));

            var mi2 = TypeExtensions.DecodeMemberAccessExpressionOf <MyEntity>(mc => mc.BaseBool);

            Assert.That(mi2.DeclaringType, Is.EqualTo(typeof(BaseEntity)));
            Assert.That(mi2.ReflectedType, Is.EqualTo(typeof(MyEntity)));
        }
예제 #3
0
 public void WhenDecodeMemberAccessExpressionOfOnInheritedEntityInterfaceThenDecodeMember()
 {
     Assert.That(TypeExtensions.DecodeMemberAccessExpressionOf <IMyEntity>(m => m.Id), Is.Not.Null);
     Assert.That(TypeExtensions.DecodeMemberAccessExpressionOf <IMyEntity, Guid>(m => m.Id), Is.Not.Null);
 }