Here is the solution that ultimately worked for me. I asked an actual developer this question instead of trying to figure it out myself (I'm QA) :) I had to add some special logic to format the string properly because the attr.TestCategories object is a List.
//find method with testcategory attribute
if (attrs.Any(x => x is TestCategoryAttribute))
{
var testCategoryAttrs = attrs.Where(x => x is TestCategoryAttribute);
if (testCategoryAttrs.Any())
{
foreach (var testCategoryAttr in testCategoryAttrs)
{
TestCategoryAttribute attr = (TestCategoryAttribute)testCategoryAttr;
testCategories += string.IsNullOrEmpty(testCategories)
? string.Join(", ", attr.TestCategories)
: string.Format(", {0}", string.Join(", ", attr.TestCategories));
}
}
}