ArchiMetrics.Analysis.Tests.CoverageAnalyzerTests.WhenNotCoveredByTestThenFindsNoCoverage C# (CSharp) Метод

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

private WhenNotCoveredByTestThenFindsNoCoverage ( ) : Task
Результат Task
		public async Task WhenNotCoveredByTestThenFindsNoCoverage()
		{
			var code = @"namespace MyCode
{
	public class MyClass
	{
		public string Get(int value)
		{
			return GetInternal(value);
		}

		private string GetInternal(int value)
		{
			return value.ToString();
		}
	}
}";

			var solution = CreateSolution(code);
			var projectCompilations = (from project in solution.Projects
									   let compilation = project.GetCompilationAsync()
									   select new
											  {
												  Documents = project.Documents.Select(
													  x => new
														   {
															   Tree = x.GetSyntaxTreeAsync(),
															   Root = x.GetSyntaxRootAsync()
														   }),
												  Compilation = compilation
											  })
				.AsArray();
			await Task.WhenAll(
				projectCompilations.SelectMany(x => x.Documents.SelectMany(y => new Task[] { y.Root, y.Tree })));

			var matches = (from x in projectCompilations
						   from doc in x.Documents
						   let model = x.Compilation.Result.GetSemanticModel(doc.Tree.Result)
						   let root = doc.Root.Result
						   from method in root.DescendantNodes()
							   .OfType<MethodDeclarationSyntax>()
						   where !method.AttributeLists.Any(
							   a => a.Attributes.Any(
								   b => b.Name.ToString()
											.IsKnownTestAttribute()))
						   select model.GetDeclaredSymbol(method))
				.AsArray();

			var analyzer = new CoverageAnalyzer(solution);
			var areReferencedTasks = matches.Select(analyzer.IsReferencedInTest).AsArray();
			var areReferenced = await Task.WhenAll(areReferencedTasks);

			Assert.False(areReferenced.All(x => x));
		}
	}