Пример #1
0
        public void GetMember_Instance_MethodCallExpression()
        {
            var member = MemberInfoFromExpressionUtility.GetMember((DomainType obj) => obj.InstanceMethod());

            var expected = typeof(DomainType).GetMember("InstanceMethod").Single();

            Assert.That(member, Is.EqualTo(expected));
        }
Пример #2
0
        public void GetMember_Instance_MemberExpression_OverridingProperty()
        {
            var member = MemberInfoFromExpressionUtility.GetMember((DomainType obj) => obj.OverridingProperty);

            var expected = typeof(DomainTypeBase).GetProperty("OverridingProperty");

            Assert.That(member, Is.EqualTo(expected));
        }
Пример #3
0
        public void GetMember_Static_NewExpression()
        {
            var member = MemberInfoFromExpressionUtility.GetMember(() => new DomainType());

            var expected = typeof(DomainType).GetMember(".ctor").Single();

            Assert.That(member, Is.EqualTo(expected));
        }
Пример #4
0
        public void GetMember_Static_MethodCallExpression()
        {
            var member = MemberInfoFromExpressionUtility.GetMember(() => DomainType.StaticMethod());

            var expected = typeof(DomainType).GetMember("StaticMethod").Single();

            Assert.That(member, Is.EqualTo(expected));
        }
Пример #5
0
 public void GetMember_Static_InvalidExpression()
 {
     MemberInfoFromExpressionUtility.GetMember(() => 1);
 }
Пример #6
0
 public void GetMember_Instance_InvalidExpression()
 {
     MemberInfoFromExpressionUtility.GetMember((DomainType obj) => 1);
 }