/// <summary> /// Determines if the declared element is contained in a MSpec-related container type, /// i.e.: Context, context base class, class with <see cref="BehaviorsAttribute" />. /// </summary> static bool IsInSpecificationContainer(IDeclaredElement declaredElement) { ITypeElement containingType = null; if (declaredElement is ITypeMember) { containingType = ((ITypeMember)declaredElement).GetContainingType(); } else if (declaredElement is ITypeElement) { containingType = (ITypeElement)declaredElement; } return(IsContext(containingType) || containingType.IsBehaviorContainer() || IsContextBase(containingType)); }