Example #1
0
        public void GetMember_Static_MethodCallExpression()
        {
            var member = NormalizingMemberInfoFromExpressionUtility.GetMember(() => DomainType.StaticMethod());

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

            Assert.That(member, Is.EqualTo(expected));
        }
Example #2
0
        public void GetMethod_Static()
        {
            var member = MemberInfoFromExpressionUtility.GetMethod(() => DomainType.StaticMethod());

            var expected = typeof(DomainType).GetMethod("StaticMethod");

            Assert.That(member, Is.EqualTo(expected));
        }
Example #3
0
 public void GetProperty_Static_NonMemberExpression()
 {
     NormalizingMemberInfoFromExpressionUtility.GetProperty(() => DomainType.StaticMethod());
 }
Example #4
0
 public void GetGenericMethodDefinition_Static_NonGenericMethod()
 {
     NormalizingMemberInfoFromExpressionUtility.GetGenericMethodDefinition(() => DomainType.StaticMethod());
 }
Example #5
0
 public void GetField_Static_NonMemberExpression()
 {
     MemberInfoFromExpressionUtility.GetField(() => DomainType.StaticMethod());
 }
        public void VisitNewDelegate_Static()
        {
            var delegateType = typeof(Action);
            var delegateCtor = delegateType.GetConstructors().Single();
            var method       = NormalizingMemberInfoFromExpressionUtility.GetMethod(() => DomainType.StaticMethod());
            var expression   = new NewDelegateExpression(delegateType, null, method);

            _ilGeneratorMock.Setup(mock => mock.Emit(OpCodes.Ldnull)).Verifiable();
            _ilGeneratorMock.Setup(mock => mock.Emit(OpCodes.Ldftn, expression.Method)).Verifiable();
            _ilGeneratorMock.Setup(mock => mock.Emit(OpCodes.Newobj, delegateCtor)).Verifiable();

            _emitter.VisitNewDelegate(expression);

            _ilGeneratorMock.Verify();
        }