public void CanGetIssueCodesFromProperty() { IList <IssueCode> codes = IssueCodeUtils.GetIssueCodes(typeof(TestWithIssueCodesInProperty)); Assert.AreEqual(2, codes.Count); Assert.AreEqual("TESTPROP.CODE1", codes[0].ID); Assert.AreEqual("TESTPROP.CODE2", codes[1].ID); Assert.AreEqual("code 1", codes[0].Description); Assert.AreEqual("code 2", codes[1].Description); }
public void CanGetIssueCodesFromField() { IList <IssueCode> codes = IssueCodeUtils.GetIssueCodes(typeof(TestWithIssueCodesInField)); Assert.AreEqual(2, codes.Count); Assert.AreEqual("TESTFIELD.CODEA", codes[0].ID); Assert.AreEqual("TESTFIELD.CODEB", codes[1].ID); Assert.AreEqual("code A", codes[0].Description); Assert.AreEqual("code B", codes[1].Description); }
internal HtmlTestDescriptor([NotNull] TestDescriptor testDescriptor) { Assert.ArgumentNotNull(testDescriptor, nameof(testDescriptor)); TestFactory testFactory = Assert.NotNull(TestDescriptorUtils.GetTestFactory(testDescriptor)); Name = testDescriptor.Name; Description = StringUtils.IsNotEmpty(testDescriptor.Description) ? testDescriptor.Description : null; TestDescription = testFactory.GetTestDescription(); Signature = TestImplementationUtils.GetTestSignature(testFactory); Type testType; if (testDescriptor.TestClass != null) { testType = testDescriptor.TestClass.GetInstanceType(); ConstructorId = testDescriptor.TestConstructorId; UsesConstructor = true; IsObsolete = TestDescriptorUtils.IsObsolete(testType, ConstructorId, out _obsoleteMessage); } else if (testDescriptor.TestFactoryDescriptor != null) { testType = testDescriptor.TestFactoryDescriptor.GetInstanceType(); ConstructorId = -1; UsesConstructor = false; IsObsolete = ReflectionUtils.IsObsolete(testType, out _obsoleteMessage); } else { throw new ArgumentException("Invalid test descriptor"); } AssemblyName = Path.GetFileName(testType.Assembly.Location); ClassName = testType.FullName; _issueCodes = IssueCodeUtils.GetIssueCodes(testType).ToList(); _testCategories = testFactory.TestCategories.OrderBy(c => c).ToList(); foreach (TestParameter testParameter in testFactory.Parameters) { var htmlTestParameter = new HtmlTestParameter(testParameter); _parameters.Add(htmlTestParameter); _testParametersByName.Add(testParameter.Name, htmlTestParameter); } }