示例#1
0
        public void GetSyntaxTreeForUnsupportedQueryReturnsNull()
        {
            // Given
            Query query = GetQuery("FSharpProgram.linq");

            // When
            SyntaxTree syntaxTree = CodeAnalysisUtil.GetSyntaxTree(query);

            // Then
            Assert.IsNull(syntaxTree);
        }
示例#2
0
        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);
        }