public void TypeofSomeIsConvertedToSomeDotClass() { var text = "typeof(string)"; var apex = GenericExpressionHelper.ConvertTypeofExpressionsToApex(text); Assert.AreEqual("string.class", apex); text = "mock(typeof(MyLittleClass))"; apex = GenericExpressionHelper.ConvertTypeofExpressionsToApex(text); Assert.AreEqual("mock(MyLittleClass.class)", apex); // backward conversion is supported text = "typeof(Map<string, string>)"; apex = GenericExpressionHelper.ConvertTypeofExpressionsToApex(text); Assert.AreEqual("Map<string, string>.class", apex); }
private ApexExpressionSyntax ConvertExpression(ExpressionSyntax expression) { if (expression == null) { return(null); } var apexExpr = expression.ToString(); apexExpr = GenericExpressionHelper.ConvertSoqlQueriesToApex(apexExpr); apexExpr = GenericExpressionHelper.ConvertSoqlStatementsToApex(apexExpr); apexExpr = GenericExpressionHelper.ConvertTypeofExpressionsToApex(apexExpr); apexExpr = GenericExpressionHelper.ConvertCSharpIsTypeExpressionToApex(apexExpr); apexExpr = GenericExpressionHelper.ConvertCSharpTypesToApex(apexExpr); apexExpr = apexExpr.Replace("\"", "'"); return(new ApexExpressionSyntax(apexExpr)); }