/// <summary> /// Create test element. /// Currently trx supports only UnitTest and OrderedTest. All tests except OrderedTest all converted to UnitTest. /// </summary> /// <param name="testId"></param> /// <param name="name"></param> /// <param name="fullyQualifiedName"></param> /// <param name="adapter"></param> /// <param name="source"></param> /// <param name="testType"></param> /// <returns>Trx test element</returns> private static TestElement CreateTestElement(Guid testId, string name, string fullyQualifiedName, string adapter, string source, TestType testType) { TestElement testElement = null; if (testType.Equals(Constants.OrderedTestType)) { testElement = new OrderedTestElement(testId, name, adapter); } else { var codeBase = source; var testMethod = GetTestMethod(name, fullyQualifiedName, source); testElement = new UnitTestElement(testId, name, adapter, testMethod); (testElement as UnitTestElement).CodeBase = codeBase; } return(testElement); }
/// <summary> /// Create test element. /// Currently trx supports only UnitTest and OrderedTest. All tests except OrderedTest all converted to UnitTest. /// </summary> /// <param name="testId"></param> /// <param name="name"></param> /// <param name="fullyQualifiedName"></param> /// <param name="adapter"></param> /// <param name="source"></param> /// <param name="testType"></param> /// <returns>Trx test element</returns> private TestElement CreateTestElement(Guid testId, string name, string fullyQualifiedName, string adapter, string source, TestType testType) { TestElement testElement = null; if (testType.Equals(Constants.OrderedTestType)) { testElement = new OrderedTestElement(testId, name, adapter); } else { var codeBase = source; var className = GetTestClassName(name, fullyQualifiedName, source); var testMethodName = fullyQualifiedName.StartsWith($"{className}.") ? fullyQualifiedName.Remove(0, $"{className}.".Length) : fullyQualifiedName; var testMethod = new TestMethod(testMethodName, className); testElement = new UnitTestElement(testId, name, adapter, testMethod); (testElement as UnitTestElement).CodeBase = codeBase; } return(testElement); }