public void GetSyntaxTreeForUnsupportedQueryReturnsNull() { // Given Query query = GetQuery("FSharpProgram.linq"); // When SyntaxTree syntaxTree = CodeAnalysisUtil.GetSyntaxTree(query); // Then Assert.IsNull(syntaxTree); }
public void GetSyntaxTreeForVbExpressionQueryReturnsCorrectSyntaxTree() { // Given Query query = GetQuery("VbExpression.linq"); // When SyntaxTree syntaxTree = CodeAnalysisUtil.GetSyntaxTree(query); Microsoft.CodeAnalysis.VisualBasic.VisualBasicCompilation compilation = Microsoft.CodeAnalysis.VisualBasic.VisualBasicCompilation.Create("TestCompilation", new[] { syntaxTree }); IEnumerable <Diagnostic> diagnostics = compilation.GetParseDiagnostics(); // Then Assert.IsInstanceOf <Microsoft.CodeAnalysis.VisualBasic.Syntax.CompilationUnitSyntax>(syntaxTree.GetRoot()); CollectionAssert.IsEmpty(diagnostics); }