本文整理汇总了C#中IProject.GetPersistentID方法的典型用法代码示例。如果您正苦于以下问题:C# IProject.GetPersistentID方法的具体用法?C# IProject.GetPersistentID怎么用?C# IProject.GetPersistentID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProject
的用法示例。
在下文中一共展示了IProject.GetPersistentID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrCreateTestClass
public XunitTestClassElement GetOrCreateTestClass(IProject project, IClrTypeName typeName, string assemblyLocation, MultiValueDictionary<string, string> traits)
{
var categories = GetCategories(traits);
// dotCover displays the ids of covering tests, rather than a more presentable
// name. That makes the "xunit" and project identifiers rather ugly. Fortunately,
// dotCover will ignore any text in square brackets
var id = string.Format("[xunit:{0}]{1}", project.GetPersistentID(), typeName.FullName);
var element = unitTestManager.GetElementById(project, id);
if (element != null)
{
element.State = UnitTestElementState.Valid;
var classElement = element as XunitTestClassElement;
if (classElement != null) // Shouldn't be null, unless someone else has the same id
{
classElement.AssemblyLocation = assemblyLocation; // In case it's changed, e.g. someone's switched from Debug to Release
classElement.SetCategories(categories);
}
return classElement;
}
return new XunitTestClassElement(provider, new ProjectModelElementEnvoy(project), declaredElementProvider, id, typeName.GetPersistent(), assemblyLocation, categories);
}
示例2: GetOrCreateInheritedTestMethodContainer
public XunitInheritedTestMethodContainerElement GetOrCreateInheritedTestMethodContainer(IProject project, IClrTypeName typeName, string methodName)
{
// See the comment in GetOrCreateTestClass re: dotCover showing ids instead of names.
// This element never becomes a genuine test element, so dotCover will never see it,
// but keep the id format the same
var id = string.Format("[xunit:{0}]{1}.{2}", project.GetPersistentID(), typeName.FullName, methodName);
var element = unitTestManager.GetElementById(project, id);
if (element != null)
return element as XunitInheritedTestMethodContainerElement;
return new XunitInheritedTestMethodContainerElement(provider, new ProjectModelElementEnvoy(project), id, typeName.GetPersistent(), methodName);
}
示例3: GetClassElementId
private static string GetClassElementId(IProject project, IClrTypeName typeName)
{
var id = string.Format("fixie:{0}:{1}", project.GetPersistentID(), typeName.FullName);
return id;
}