public IUnitTestElement GetOrCreateTestCase( IProject project, TestMethodElement testMethod, string name) { var element = GetTestCase(project, testMethod, name); return element ?? CreateTestCase(provider, project, testMethod, name); }
private bool Equals(TestMethodElement other) { bool result; if (other == null) { result = false; } else { result = Equals(Id, other.Id) && Equals(TypeName, other.TypeName) && Equals(methodName, other.methodName) && Equals(AssemblyLocation, other.AssemblyLocation); } return(result); }
private bool Equals(TestMethodElement other) { bool result; if (other == null) result = false; else result = Equals(Id, other.Id) && Equals(TypeName, other.TypeName) && Equals(methodName, other.methodName) && Equals(AssemblyLocation, other.AssemblyLocation); return result; }
public IUnitTestElement GetOrCreateTestMethod(IProject project, IClrTypeName typeName, string methodName, string assemblyLocation, bool isParameterized) { var classElementId = GetClassElementId(project, typeName); var classElement = unitTestManager.GetElementById(project, classElementId) as TestClassElement; var id = string.Format("{0}.{1}", classElementId, methodName); var element = unitTestManager.GetElementById(project, id) as TestMethodElement; if (element != null) { element.State = UnitTestElementState.Valid; } else { element = new TestMethodElement( provider, classElement, new ProjectModelElementEnvoy(project), declaredElementProvider, id, typeName.GetPersistent(), methodName, assemblyLocation, isParameterized); } if (!classElement.Children.Contains(element)) classElement.Children.Add(element); return element; }
public static IUnitTestElement GetTestCase(IProject project, TestMethodElement testMethod, string name) { var id = GetTestCaseId(testMethod, GetTestCaseShortName(name, testMethod)); var unitTestElementManager = project.GetSolution().GetComponent<IUnitTestElementManager>(); return unitTestElementManager.GetElementById(project, id) as TestCaseElement; }
public static IUnitTestElement CreateTestCase(TestProvider provider, IProject project, TestMethodElement testMethod, string name) { var shortName = GetTestCaseShortName(name, testMethod); var id = GetTestCaseId(testMethod, shortName); return new TestCaseElement(provider, testMethod, new ProjectModelElementEnvoy(project), id, shortName); }
private static string GetTestCaseShortName(string caseName, TestMethodElement testMethod) { var prefix = testMethod.TypeName.FullName + "."; return caseName.StartsWith(prefix) ? caseName.Substring(prefix.Length) : caseName; }
private static string GetTestCaseId(TestMethodElement methodElement, string shortName) { return string.Format("{0}.{1}", methodElement.Id, shortName); }