내 CodedUI 테스트 프로젝트의 특성을 기반으로 보고서를 생성하는 코드가 있습니다.중복 된 메소드에 대한 속성 값을 어떻게 얻을 수 있습니까?
[TestMethod]
[TestCategory("Smoke")]
[TestCategory("Feature1")]
public void CodedUITest()
{
}
아래의 코드 내가 하나 TestCategory을 가지고 있지만 때 작동 :이 보고서에 TestCategoryAttribute를 추가 할 수 있도록하지만 다음과 같은 중복 속성 수 있도록 내 코드에 적응하는 방법을 모른다 하지 위의 여러 테스트 범주 작업 :
//Other code above to find all CodedUI classes and all public, nonstatic methods with the TestMethod attribute
//find method with testcategory attribute
if (attrs.Any(x => x is TestCategoryAttribute))
{
var testcategoryAttr = (TestCategoryAttribute)attrs.SingleOrDefault(x => x is TestCategoryAttribute);
string testCategories = string.Join(", ", testcategoryAttr.TestCategories.Select(v => v.ToString()));
}
정말로 'SingleOrDefault'를 요청하고 여러 항목을 가져올 수 없습니다. 정확히 무엇이 필요한지 잘 모르지만'SingleOrDEfault'가 아닙니다. –