Exemplo n.º 1
0
        public void VisitMemberAssignment_Unchanged()
        {
            MemberAssignment memberAssignment = ExpressionInstanceCreator.CreateMemberAssignment();

            Expect.Call(VisitorMock.Visit(memberAssignment.Expression)).Return(memberAssignment.Expression);
            var result = (MemberAssignment)InvokeAndCheckVisitObject("VisitMemberAssignment", memberAssignment);

            Assert.That(result, Is.SameAs(memberAssignment));
        }
Exemplo n.º 2
0
        public void VisitMemberAssignment_Changed()
        {
            MemberAssignment memberAssignment    = ExpressionInstanceCreator.CreateMemberAssignment();
            MemberAssignment newMemberAssignment = Expression.Bind(typeof(List <int>).GetProperty("Capacity"), Expression.Constant(2));

            Expect.Call(VisitorMock.Visit(memberAssignment.Expression)).Return(newMemberAssignment.Expression);

            var result = (MemberAssignment)InvokeAndCheckVisitObject("VisitMemberAssignment", memberAssignment);

            Assert.That(result, Is.Not.SameAs(memberAssignment));
        }
Exemplo n.º 3
0
        public void VisitMemberBinding_Delegation_MemberAssignment()
        {
            MemberAssignment memberAssignment = ExpressionInstanceCreator.CreateMemberAssignment();

            Expect.Call(InvokeVisitMethod("VisitMemberBinding", memberAssignment)).CallOriginalMethod(OriginalCallOptions.CreateExpectation);

            Expect.Call(InvokeVisitMethod("VisitMemberAssignment", memberAssignment)).Return(memberAssignment);

            MockRepository.ReplayAll();
            object result = InvokeVisitMethod("VisitMemberBinding", memberAssignment);

            MockRepository.VerifyAll();

            Assert.That(result, Is.SameAs(memberAssignment));
        }