protected override void AppendExpressionPart(string part) { // replace string.class => typeof(string), string.valueOf(x) => x.ToString(), etc part = GenericExpressionHelper.ConvertTypeofExpressionsToCSharp(part); part = GenericExpressionHelper.ConvertStringValueofToString(part); part = GenericExpressionHelper.ConvertApexInstanceOfTypeExpressionToCSharp(part); part = GenericExpressionHelper.ConvertApexTypesToCSharp(part); base.AppendExpressionPart(part); }
public void ApexInstanceOfConvertedToCSharpAndBackAgain() { string ToCSharp(string x) => GenericExpressionHelper.ConvertApexInstanceOfTypeExpressionToCSharp(x); string ToApex(string x) => GenericExpressionHelper.ConvertCSharpIsTypeExpressionToApex(x); var text = "Property instanceof int"; var csharp = ToCSharp(text); Assert.AreEqual("Property is int", csharp); var apex = ToApex(csharp); Assert.AreEqual(text, apex); text = @"int a = Value instanceof Map<string, string> ? 10 : 20"; csharp = ToCSharp(text); Assert.AreEqual(@"int a = Value is Map<string, string> ? 10 : 20", csharp); apex = ToApex(csharp); Assert.AreEqual(text, apex); }