ArchiMetrics.CodeReview.Rules.Tests.Rules.SemanticRulesTests.CanFindUnusedCode C# (CSharp) Метод

CanFindUnusedCode() приватный Метод

private CanFindUnusedCode ( string code, SyntaxKind kind, Type semanticRule ) : void
code string
kind SyntaxKind
semanticRule System.Type
Результат void
		public void CanFindUnusedCode(string code, SyntaxKind kind, Type semanticRule)
		{
			var solution = CreateSolution(code);
			var method = solution.Projects.SelectMany(p => p.Documents)
				.SelectMany(d =>
							{
								var semanticModel = d.GetSemanticModelAsync().Result;
								return d.GetSyntaxRootAsync().Result
									.DescendantNodes()
									.OfType<SyntaxNode>()
									.Select(r =>
										new
										{
											node = r, 
											model = semanticModel
										});
							})
							.First(x => x.node.IsKind(kind));

			var rule = (ISemanticEvaluation)Activator.CreateInstance(semanticRule);
			var result = rule.Evaluate(method.node, method.model, solution);

			Assert.NotNull(result);
		}
	}
SemanticRulesTests