private void navigationProvider1_CheckAvailability(object sender, CheckContentAvailabilityEventArgs ea) { if (ea.Element == null) { return; } IElement declaration; if (ea.Element.ElementType == LanguageElementType.TypeReferenceExpression) { declaration = ea.Element.GetDeclaration(); } else { declaration = (IElement)ea.Element.GetClass() ?? (IElement)ea.Element.GetStruct() ?? (IElement)ea.Element.GetInterface(); } if (declaration == null) { return; } ITypeElement typeElement = declaration as ITypeElement; if (typeElement == null) { return; } _classes = new List <LanguageElement>(); var elements = typeElement.FindAllReferences().ToLanguageElementCollection(); var elementsInTests = from element in elements.OfType <LanguageElement>() let cls = element.GetClass() where ClassIsTestClass(cls) select element; if (elementsInTests.Count() == 0) { ea.Available = false; return; } _classes = elementsInTests.ToList(); ea.Available = true; ea.MenuCaption = string.Format("Test{0} {1} {2}", _classes.MoreThanOne() ? "s" : "", (char)0x21d2, typeElement.Name); }