Ejemplo n.º 1
0
            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);
            }
Ejemplo n.º 2
0
            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;
                    }
                }
            }
Ejemplo n.º 3
0
			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;
				}
			}