public override void SetUp()
        {
            base.SetUp();
            WrapperAssert.SupportsSpecialFeatures = false;
            WrapperAssert.SupportsSpecialName = false;
            WrapperAssert.SupportsCallingConventions = false;
            WrapperAssert.SupportsReturnAttributes = false;
            WrapperAssert.SupportsEventFields = false;
            WrapperAssert.SupportsGenericParameterAttributes = false;
            WrapperAssert.SupportsFinalizers = false;
            WrapperAssert.SupportsStaticConstructors = false; // compiler generated static constructors introduced by static readonly fields are not supported

            PsiManager manager = PsiManager.GetInstance(SolutionManager.Instance.CurrentSolution);

            reflectionPolicy = new PsiReflectionPolicy(manager);
        }
            private bool EvalTestPartPredicate(IDeclaredElement element, Predicate<TestPart> predicate)
            {
#if RESHARPER_45_OR_NEWER
                using (ReadLockCookie.Create())
#endif
                {
                    if (!element.IsValid())
                        return false;

                    try
                    {
                        PsiReflectionPolicy reflectionPolicy = new PsiReflectionPolicy(element.GetManager());
                        ICodeElementInfo elementInfo = reflectionPolicy.Wrap(element);
                        if (elementInfo == null)
                            return false;

                        ITestDriver driver = CreateTestDriver();
                        IList<TestPart> testParts = driver.GetTestParts(reflectionPolicy, elementInfo);
                        return GenericCollectionUtils.Exists(testParts, predicate);
                    }
                    catch (Exception ex)
                    {
                        HandleEmbeddedProcessCancelledException(ex);
                        throw;
                    }
                }
            }
            private static void PopulateCodeElementsFromTypeDeclaration(List<ICodeElementInfo> codeElements, PsiReflectionPolicy reflectionPolicy, ITypeDeclaration declaration)
            {
                if (! declaration.IsValid())
                    return;

                ITypeInfo typeInfo = reflectionPolicy.Wrap(declaration.DeclaredElement);

                if (typeInfo != null)
                    codeElements.Add(typeInfo);

                foreach (ITypeDeclaration nestedDeclaration in declaration.NestedTypeDeclarations)
                    PopulateCodeElementsFromTypeDeclaration(codeElements, reflectionPolicy, nestedDeclaration);
            }
            /// <summary>
            /// Explores given PSI file.
            /// </summary>
            public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
            {
                if (psiFile == null)
                    throw new ArgumentNullException("psiFile");
                if (consumer == null)
                    throw new ArgumentNullException("consumer");

#if ! RESHARPER_31 && ! RESHARPER_40 && ! RESHARPER_41
                using (ReadLockCookie.Create())
#endif
                {
                    if (!psiFile.IsValid())
                        return;

                    try
                    {
                        PsiReflectionPolicy reflectionPolicy = new PsiReflectionPolicy(psiFile.GetManager());
                        ConsumerAdapter consumerAdapter = new ConsumerAdapter(provider, consumer, psiFile);

                        var codeElements = new List<ICodeElementInfo>();
                        psiFile.ProcessDescendants(new OneActionProcessorWithoutVisit(delegate(IElement element)
                        {
                            ITypeDeclaration declaration = element as ITypeDeclaration;
                            if (declaration != null)
                                PopulateCodeElementsFromTypeDeclaration(codeElements, reflectionPolicy, declaration);
                        }, delegate(IElement element)
                        {
                            if (interrupted())
                                throw new ProcessCancelledException();

                            // Stop recursing at the first type declaration found.
                            return element is ITypeDeclaration;
                        }));

                        Describe(reflectionPolicy, codeElements, consumerAdapter);

                        ProjectFileState.SetFileState(psiFile.GetProjectFile(), consumerAdapter.CreateProjectFileState());
                    }
                    catch (Exception ex)
                    {
                        HandleEmbeddedProcessCancelledException(ex);
                        throw;
                    }
                }
            }
			private bool EvalTestPartPredicate(IDeclaredElement element, Predicate<TestPart> predicate)
			{
				if (!element.IsValid())
					return false;

				try
				{
#if RESHARPER_60
					var reflectionPolicy = new PsiReflectionPolicy(element.GetPsiServices().PsiManager);
#else
					var reflectionPolicy = new PsiReflectionPolicy(element.GetPsiServices().PsiManager, provider.CacheManager);
#endif
					var elementInfo = reflectionPolicy.Wrap(element);
					if (elementInfo == null)
						return false;

					var driver = CreateTestDriver();
					var testParts = driver.GetTestParts(reflectionPolicy, elementInfo);
					return GenericCollectionUtils.Exists(testParts, predicate);
				}
				catch (Exception ex)
				{
					HandleEmbeddedProcessCancelledException(ex);
					throw;
				}
			}