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

WhenFieldIsNeverReadThenReturnsError() private method

private WhenFieldIsNeverReadThenReturnsError ( string code ) : void
code string
return void
            public void WhenFieldIsNeverReadThenReturnsError(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 = _rule.Evaluate(classDeclaration.node, classDeclaration.semanticModel, solution);

                Assert.NotNull(result);
            }