static bool IsTestMethodOfOldMsTest([CanBeNull] IMethodDeclaration methodDeclaration) { if (methodDeclaration == null || !methodDeclaration.IsDeclaredInOldMsTestProject()) { return(false); } var testMethodAttributeTypes = null as IDeclaredType[]; return(methodDeclaration.Attributes.Any( attribute => { if (attribute == null) { return false; } if (testMethodAttributeTypes == null) { testMethodAttributeTypes = new IDeclaredType[testMethodAttributes.Length]; for (var i = 0; i < testMethodAttributes.Length; i++) { testMethodAttributeTypes[i] = TypeFactory.CreateTypeByCLRName( testMethodAttributes[i], NullableAnnotation.Unknown, methodDeclaration.GetPsiModule()); } } var attributeType = attribute.GetAttributeInstance().GetAttributeType(); return testMethodAttributeTypes.Any( type => attributeType.Equals(type, TypeEqualityComparer.Default) || attributeType.IsSubtypeOf(type)); })); }