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); }
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); }