本文整理汇总了C#中AnalyzeCSharp类的典型用法代码示例。如果您正苦于以下问题:C#AnalyzeCSharp类的具体用法?C#AnalyzeCSharp怎么用?C#AnalyzeCSharp使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:TopLevelNamespaceContainsDirectlyNestedNamespaces
publicvoidTopLevelNamespaceContainsDirectlyNestedNamespaces()
{
//Given
stringcode=@"
namespaceFoo
{
}
namespaceFoo.Baz
{
}
namespaceBar
{
}
";
IDocumentdocument=GetDocument(code);
IExecutionContextcontext=GetContext();
IModulemodule=newAnalyzeCSharp();
//When
List
results=module.Execute(new[]{document},context).ToList();//Makesuretomaterializetheresultlist
//Then
CollectionAssert.AreEquivalent(new[]{string.Empty,"Foo","Baz","Bar"},results.Select(x=>x["Name"]));
CollectionAssert.AreEquivalent(new[]{"Foo","Bar"},
results.Single(x=>x["Name"].Equals(string.Empty)).Get>("MemberNamespaces").Select(x=>x["Name"]));
}
原文链接:http://www.jxszl.com/biancheng/C/556524.html