ArchiMetrics.CodeReview.Rules.Tests.Rules.Semantic.UnreadVariableRuleTests.GivenAnUnreadVariableRule.WhenFieldIsReadThenDoesNotReturnError C# (CSharp) Method

WhenFieldIsReadThenDoesNotReturnError() private method

private WhenFieldIsReadThenDoesNotReturnError ( string code ) : System.Threading.Tasks.Task
code string
return System.Threading.Tasks.Task
            public async Task WhenFieldIsReadThenDoesNotReturnError(string code)
            {
                var solution = CreateSolution(code);
                var classDeclaration = (from p in solution.Projects
                                        from d in p.Documents
                                        let model = d.GetSemanticModelAsync().Result
                                        let root = d.GetSyntaxRootAsync().Result
                                        from n in root.DescendantNodes().OfType<VariableDeclarationSyntax>()
                                        select new
                                        {
                                            semanticModel = model,
                                            node = n
                                        }).First();
                var result = await _rule.Evaluate(classDeclaration.node, classDeclaration.semanticModel, solution);

                Assert.Null(result);
            }
        }