Exemple #1
0
        public void LiftCastExpressionWithSelfTarget()
        {
            var        self          = new SelfLiteralExpression();
            var        typeReference = new SimpleTypeReference("T");
            Expression cast          = new TryCastExpression(self, typeReference);
            var        parameter     = ParameterDeclaration.Lift(cast);

            Assert.AreEqual("self", parameter.Name);
            Assert.IsTrue(typeReference.Matches(parameter.Type));
            Assert.AreNotSame(typeReference, parameter.Type);
        }
Exemple #2
0
        public void LiftCastExpression()
        {
            var        referenceExpression = new ReferenceExpression("foo");
            var        typeReference       = new SimpleTypeReference("T");
            Expression cast      = new TryCastExpression(referenceExpression, typeReference);
            var        parameter = ParameterDeclaration.Lift(cast);

            Assert.AreEqual(referenceExpression.Name, parameter.Name);
            Assert.IsTrue(typeReference.Matches(parameter.Type));
            Assert.AreNotSame(typeReference, parameter.Type);
        }