Ejemplo n.º 1
0
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     if ((psiFile.Language.Is <JavaScriptLanguage>() && !psiFile.Language.Is <JavaScriptWinRTLanguage>()) && (psiFile.GetProject() != null))
     {
         psiFile.ProcessDescendants(new JasmineFileExplorer(myFactory, consumer, psiFile, interrupted, myJavaScriptDependencyManager.GetTransitiveDependencies(psiFile.GetSourceFile())));
     }
 }
Ejemplo n.º 2
0
        public FileExplorer(IUnitTestProvider provider,
                            UnitTestElementLocationConsumer consumer,
                            IFile file,
                            CheckForInterrupt interrupted)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            _consumer    = consumer;
            _file        = file;
            _interrupted = interrupted;

            IProject project      = file.ProjectFile.GetProject();
            string   assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath;

            var cache          = new ContextCache();
            var contextFactory = new ContextFactory(provider, project, assemblyPath, cache);
            var contextSpecificationFactory  = new ContextSpecificationFactory(provider, project, cache);
            var behaviorFactory              = new BehaviorFactory(provider, project, cache);
            var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project);

            _elementHandlers = new List <IElementHandler>
            {
                new ContextElementHandler(contextFactory),
                new ContextSpecificationElementHandler(contextSpecificationFactory),
                new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory)
            };
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile.Language.Name != "CSHARP" && psiFile.Language.Name != "VBASIC")
                return;

            psiFile.ProcessDescendants(new XunitFileExplorer(factory, psiFile, searchDomainFactory, consumer, interrupted));
        }
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
   if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC"))
   {
     psiFile.ProcessDescendants(new FileExplorer(_provider, _factories, psiFile, consumer, interrupted));
   }
 }
Ejemplo n.º 5
0
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (!xUnitInstalled)
            {
                return;
            }

            if (provider == null)
            {
                return;
            }

            if (psiFile == null)
            {
                throw new ArgumentNullException("psiFile");
            }

            var project = psiFile.GetProject();

            if (project == null)
            {
                return;
            }

            if (project.GetAssemblyReferences().Any(IsSilverlightMscorlib))
            {
                return;
            }

            var psiFileExplorer = (IRecursiveElementProcessor)Activator.CreateInstance(XunitPsiFileExplorerType,
                                                                                       provider, consumer, psiFile, interrupted);

            psiFile.ProcessDescendants(psiFileExplorer);
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (!xUnitInstalled)
                return;

            if (provider == null)
                return;

            if (psiFile == null)
                throw new ArgumentNullException("psiFile");

            var project = psiFile.GetProject();
            if (project == null)
                return;

            if (project.GetAssemblyReferences().Any(IsSilverlightMscorlib))
                return;

            var fileExplorers = psiFile.GetProject().GetSolution().GetComponents<IUnitTestFileExplorer>();
            var xunitTestFileExplorer = fileExplorers.Single(e => e.GetType().FullName == "XunitContrib.Runner.ReSharper.UnitTestProvider.XunitTestFileExplorer");
            var unitTestElementFactory = xunitTestFileExplorer.GetField<object>("unitTestElementFactory");
            var xunitPsiFileExplorerType = xunitTestFileExplorer.GetType().Assembly.GetType("XunitContrib.Runner.ReSharper.UnitTestProvider.XunitPsiFileExplorer");
            var xunitPsiFileExplorer = (IRecursiveElementProcessor)Activator.CreateInstance(xunitPsiFileExplorerType,
                 provider, unitTestElementFactory, consumer, psiFile, interrupted);

            psiFile.ProcessDescendants(xunitPsiFileExplorer);
        }
    public FileExplorer(IUnitTestProvider provider,
                        UnitTestElementLocationConsumer consumer,
                        IFile file,
                        CheckForInterrupt interrupted)
    {
      if (file == null)
      {
        throw new ArgumentNullException("file");
      }

      if (provider == null)
      {
        throw new ArgumentNullException("provider");
      }

      _consumer = consumer;
      _file = file;
      _interrupted = interrupted;

      IProject project = file.ProjectFile.GetProject();
      string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath;

      var contextFactory = new ContextFactory(provider, project, assemblyPath);
      var contextSpecificationFactory = new ContextSpecificationFactory(provider, project);
      var behaviorFactory = new BehaviorFactory(provider, project);
      var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project);

      _elementHandlers = new List<IElementHandler>
                         {
                           new ContextElementHandler(contextFactory),
                           new ContextSpecificationElementHandler(contextSpecificationFactory),
                           new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory)
                         };
    }
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, Func <bool> interrupted)
 {
     if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC"))
     {
         psiFile.ProcessDescendants(new FileExplorer(_provider, _factories, psiFile, consumer, interrupted));
     }
 }
Ejemplo n.º 9
0
    public FileExplorer(MSpecUnitTestProvider provider,
                        ElementFactories factories,
                        IFile file,
                        UnitTestElementLocationConsumer consumer,
                        Func<bool> interrupted)
    {
      if (file == null)
      {
        throw new ArgumentNullException("file");
      }

      if (provider == null)
      {
        throw new ArgumentNullException("provider");
      }

      _consumer = consumer;
      _file = file;
      _interrupted = interrupted;

      var project = file.GetSourceFile().ToProjectFile().GetProject();
        
#if !RESHARPER_8
      _assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath;
#else
      _assemblyPath = project.GetOutputFilePath().FullPath;
#endif

      _elementHandlers = new List<IElementHandler>
                         {
                           new ContextElementHandler(factories),
                           new ContextSpecificationElementHandler(factories),
                           new BehaviorElementHandler(factories)
                         };
    }
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     if ((psiFile.Language.Is<JavaScriptLanguage>() && !psiFile.Language.Is<JavaScriptWinRTLanguage>()) && (psiFile.GetProject() != null))
     {
         psiFile.ProcessDescendants(new JasmineFileExplorer(myFactory, consumer, psiFile, interrupted, myJavaScriptDependencyManager.GetTransitiveDependencies(psiFile.GetSourceFile())));
     }
 }
        public FileExplorer(MSpecUnitTestProvider provider,
                            ElementFactories factories,
                            IFile file,
                            UnitTestElementLocationConsumer consumer,
                            Func <bool> interrupted)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            _consumer    = consumer;
            _file        = file;
            _interrupted = interrupted;

            var project = file.GetSourceFile().ToProjectFile().GetProject();

            _assemblyPath = project.GetOutputFilePath().FullPath;

            _elementHandlers = new List <IElementHandler>
            {
                new ContextElementHandler(factories),
                new ContextSpecificationElementHandler(factories),
                new BehaviorElementHandler(factories)
            };
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile.Language.Name != "CSHARP" && psiFile.Language.Name != "VBASIC")
                return;

            psiFile.ProcessDescendants(new XunitFileExplorer(provider, psiFile.GetSourceFile().ToProjectFile(), consumer, interrupted));
        }
 public PsiFileExplorer(UnitTestElementFactory unitTestElementFactory, TestIdentifier conventionCheck, UnitTestElementLocationConsumer consumer, IFile psiFile, CheckForInterrupt interrupted)
 {
     this.unitTestElementFactory = unitTestElementFactory;
     this.conventionCheck        = conventionCheck;
     this.consumer    = consumer;
     this.psiFile     = psiFile;
     this.interrupted = interrupted;
 }
 public PsiFileExplorer(UnitTestElementFactory unitTestElementFactory, TestIdentifier conventionCheck, UnitTestElementLocationConsumer consumer, IFile psiFile, Func<bool> interrupted)
 {
     this.unitTestElementFactory = unitTestElementFactory;
     this.conventionCheck = conventionCheck;
     this.consumer = consumer;
     this.psiFile = psiFile;
     this.interrupted = interrupted;
 }
        public SimpleTestingPsiFileExplorer(UnitTestElementLocationConsumer consumer, IFile psiFile, CheckForInterrupt interrupted, SimpleTestingElementFactory elementFactory)
        {
            _consumer = consumer;
            _psiFile = psiFile;
            _interrupted = interrupted;
            _elementFactory = elementFactory;

             _specificationCollections = new Dictionary<ITypeElement, SpecificationContainerElement>();
        }
Ejemplo n.º 16
0
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile == null)
              {
            throw new ArgumentNullException("psiFile");
              }

              psiFile.ProcessDescendants(new FileExplorer(this, consumer, psiFile, interrupted));
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile == null)
            {
                throw new ArgumentNullException("psiFile");
            }

            psiFile.ProcessDescendants(new FileExplorer(this, consumer, psiFile, interrupted));
        }
Ejemplo n.º 18
0
            /// <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;
                    }
                }
            }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC"))
            {
                psiFile.ProcessDescendants(new FileExplorer(_provider,
#if RESHARPER_61
                                                            _manager, _psiModuleManager, _cacheManager,
#endif
                                                            consumer, psiFile, interrupted));
            }
        }
Ejemplo n.º 20
0
    public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
    {
      if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC"))
      {
		  RecursiveElementProcessorExtensions.ProcessDescendants(psiFile, new FileExplorer(_provider,
#if RESHARPER_61
          _manager, _psiModuleManager, _cacheManager, 
#endif
          consumer, psiFile, interrupted));
      }
    }
    public FileExplorer(MSpecUnitTestProvider provider,
#if RESHARPER_61
                        IUnitTestElementManager manager,
                        PsiModuleManager psiModuleManager,
                        CacheManager cacheManager,
#endif
                        UnitTestElementLocationConsumer consumer,
                        IFile file,
                        CheckForInterrupt interrupted)
    {
      if (file == null)
      {
        throw new ArgumentNullException("file");
      }

      if (provider == null)
      {
        throw new ArgumentNullException("provider");
      }

      _consumer = consumer;
      _file = file;
      _interrupted = interrupted;

#if RESHARPER_6
      IProject project = file.GetSourceFile().ToProjectFile().GetProject();
#else
      IProject project = file.ProjectFile.GetProject();
#endif
      var projectEnvoy = new ProjectModelElementEnvoy(project);
      string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath;

      var cache = new ContextCache();


#if RESHARPER_61
      var contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, assemblyPath, cache);
      var contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
      var behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
      var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy);
#else
      var contextFactory = new ContextFactory(provider, project, projectEnvoy, assemblyPath, cache);
      var contextSpecificationFactory = new ContextSpecificationFactory(provider, project, projectEnvoy, cache);
      var behaviorFactory = new BehaviorFactory(provider, project, projectEnvoy, cache);
      var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy);
#endif

      _elementHandlers = new List<IElementHandler>
                         {
                           new ContextElementHandler(contextFactory),
                           new ContextSpecificationElementHandler(contextSpecificationFactory),
                           new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory)
                         };
    }
Ejemplo n.º 22
0
        public FileExplorer(MSpecUnitTestProvider provider,
#if RESHARPER_61
                            IUnitTestElementManager manager,
                            PsiModuleManager psiModuleManager,
                            CacheManager cacheManager,
#endif
                            UnitTestElementLocationConsumer consumer,
                            IFile file,
                            CheckForInterrupt interrupted)
        {
            if (file == null)
            {
                throw new ArgumentNullException("file");
            }

            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            _consumer    = consumer;
            _file        = file;
            _interrupted = interrupted;

#if RESHARPER_6
            IProject project = file.GetSourceFile().ToProjectFile().GetProject();
#else
            IProject project = file.ProjectFile.GetProject();
#endif
            var    projectEnvoy = new ProjectModelElementEnvoy(project);
            string assemblyPath = UnitTestManager.GetOutputAssemblyPath(project).FullPath;

            var cache = new ContextCache();


#if RESHARPER_61
            var contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, assemblyPath, cache);
            var contextSpecificationFactory  = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
            var behaviorFactory              = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
            var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy);
#else
            var contextFactory = new ContextFactory(provider, project, projectEnvoy, assemblyPath, cache);
            var contextSpecificationFactory  = new ContextSpecificationFactory(provider, project, projectEnvoy, cache);
            var behaviorFactory              = new BehaviorFactory(provider, project, projectEnvoy, cache);
            var behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy);
#endif

            _elementHandlers = new List <IElementHandler>
            {
                new ContextElementHandler(contextFactory),
                new ContextSpecificationElementHandler(contextSpecificationFactory),
                new BehaviorElementHandler(behaviorFactory, behaviorSpecificationFactory)
            };
        }
Ejemplo n.º 23
0
            /// <summary>
            /// Explores given PSI file.
            /// </summary>
            public void ExploreFile(ITreeNode psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
            {
                if (psiFile == null)
                {
                    throw new ArgumentNullException("psiFile");
                }
                if (consumer == null)
                {
                    throw new ArgumentNullException("consumer");
                }

                if (!psiFile.IsValid())
                {
                    return;
                }

                try
                {
#if RESHARPER_60
                    var reflectionPolicy = new PsiReflectionPolicy(psiFile.GetPsiServices().PsiManager);
#else
                    var reflectionPolicy = new PsiReflectionPolicy(psiFile.GetPsiServices().PsiManager, provider.CacheManager);
#endif
                    var consumerAdapter = new ConsumerAdapter(provider, consumer, psiFile);

                    var codeElements = new List <ICodeElementInfo>();
                    psiFile.ProcessDescendants(new OneActionProcessorWithoutVisit(delegate(ITreeNode element)
                    {
                        var declaration = element as ITypeDeclaration;
                        if (declaration != null)
                        {
                            PopulateCodeElementsFromTypeDeclaration(codeElements, reflectionPolicy, declaration);
                        }
                    }, delegate(ITreeNode 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.GetSourceFile().ToProjectFile(), consumerAdapter.CreateProjectFileState());
                }
                catch (Exception ex)
                {
                    HandleEmbeddedProcessCancelledException(ex);
                    throw;
                }
            }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile == null)
                throw new ArgumentNullException("psiFile");

            var project = psiFile.GetProject();
            if (project == null)
                return;

            psiFile.ProcessDescendants(new SimpleTestingPsiFileExplorer(consumer, psiFile, interrupted, _elementFactory));
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, Func<bool> interrupted)
        {
            if (psiFile == null)
                throw new ArgumentNullException("psiFile");

            var project = psiFile.GetProject();
            if (project == null)
                return;

            if (IsSilverlightProject(project) && !IsAgUnitAvailable)
                return;

            psiFile.ProcessDescendants(new XunitPsiFileExplorer(provider, unitTestElementFactory, consumer, psiFile, interrupted, searchDomainFactory));
        }
Ejemplo n.º 26
0
                public ConsumerAdapter(GallioTestProvider provider, UnitTestElementLocationConsumer consumer, ITreeNode psiFile)
                    : this(provider, delegate(IUnitTestElement element)
                {
                    var projectFile = psiFile.GetSourceFile().ToProjectFile();

                    if (projectFile == null || !projectFile.IsValid())
                    {
                        return;
                    }

                    consumer(element.GetDisposition());
                })
                {
                }
    public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, Func<bool> interrupted)
    {
      if (psiFile == null)
          throw new ArgumentNullException("psiFile");

      var project = psiFile.GetProject();
      if (project == null)
          return;

      if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC"))
      {
        psiFile.ProcessDescendants(new FileExplorer(_provider, _factories, psiFile, consumer, interrupted));
      }
    }
        public XunitFileExplorer([NotNull] XunitTestProvider provider, [NotNull] IProjectFile projectFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (provider == null)
                throw new ArgumentNullException("provider");
            if (projectFile == null)
                throw new ArgumentNullException("projectFile");

            this.consumer = consumer;
            this.provider = provider;
            this.interrupted = interrupted;
            this.projectFile = projectFile;
            project = this.projectFile.GetProject();
            envoy = ProjectModelElementEnvoy.Create(project);
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (interrupted())
                return;

            // don't bother going any further if there's isn't a project with a reference to the Fixie assembly
            var project = psiFile.GetProject();
            if (project == null)
                return;

            if(project.GetModuleReferences().All(module => module.Name != "Fixie"))
                return;

            psiFile.ProcessDescendants(new PsiFileExplorer(unitTestElementFactory, conventionCheck, consumer, psiFile, interrupted));
        }
Ejemplo n.º 30
0
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            var psiProject = psiFile.GetProject();
            var project = _environment.GetProject(psiProject.ProjectFile.Location.FullPath);

            var stories = project.GetStories(psiFile.GetProjectFile().Location.ToString());

            foreach (var story in stories)
            {
                var range = new TextRange(0);
                UnitTestElementDisposition disposition = new UnitTestElementDisposition(
                    new StorEvilStoryElement(_provider, null, psiProject,story.Summary, story.Id ), psiProject.ProjectFile, range, range);
                consumer(disposition);
            }
        }
Ejemplo n.º 31
0
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            var psiProject = psiFile.GetProject();
            var project    = _environment.GetProject(psiProject.ProjectFile.Location.FullPath);

            var stories = project.GetStories(psiFile.GetProjectFile().Location.ToString());

            foreach (var story in stories)
            {
                var range = new TextRange(0);
                UnitTestElementDisposition disposition = new UnitTestElementDisposition(
                    new StorEvilStoryElement(_provider, null, psiProject, story.Summary, story.Id), psiProject.ProjectFile, range, range);
                consumer(disposition);
            }
        }
Ejemplo n.º 32
0
            public MyFileExplorer(IUnitTestProvider provider, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted)
            {
                if (file == null)
                {
                    throw new ArgumentNullException("file");
                }
                if (provider == null)
                {
                    throw new ArgumentNullException("provider");
                }

                myConsumer     = consumer;
                myProvider     = provider;
                myFile         = file;
                myInterrupted  = interrupted;
                myProject      = myFile.ProjectFile.GetProject();
                myAssemblyPath = UnitTestManager.GetOutputAssemblyPath(myProject).FullPath;
            }
        public XunitFileExplorer([NotNull] XunitElementFactory factory, [NotNull] ITreeNode file, [NotNull] SearchDomainFactory searchDomainFactory, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (factory == null) 
                throw new ArgumentNullException("factory");
            if (searchDomainFactory == null) 
                throw new ArgumentNullException("searchDomainFactory");
            if (file == null)
                throw new ArgumentNullException("file");

            this.factory = factory;
            this.searchDomainFactory = searchDomainFactory;
            this.consumer = consumer;
            this.interrupted = interrupted;

            projectFile = file.GetSourceFile().ToProjectFile();
            if (projectFile != null) project = projectFile.GetProject();
            envoy = ProjectModelElementEnvoy.Create(project);
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, Func <bool> interrupted)
        {
            if (psiFile == null)
            {
                throw new ArgumentNullException("psiFile");
            }

            var project = psiFile.GetProject();

            if (project == null)
            {
                return;
            }

            if ((psiFile.Language.Name == "CSHARP") || (psiFile.Language.Name == "VBASIC"))
            {
                psiFile.ProcessDescendants(new FileExplorer(_provider, _factories, psiFile, consumer, interrupted));
            }
        }
Ejemplo n.º 35
0
                public ConsumerAdapter(IUnitTestProvider provider, UnitTestElementLocationConsumer consumer, IFile psiFile)
                    : this(provider, delegate(UnitTestElement element)
                {
#if RESHARPER_31
                    IProjectFile projectFile = psiFile.ProjectItem;
#else
                    IProjectFile projectFile = psiFile.ProjectFile;
#endif
                    if (projectFile.IsValid)
                    {
                        UnitTestElementDisposition disposition = element.GetDisposition();
                        if (disposition.Locations.Count != 0 && disposition.Locations[0].ProjectFile == projectFile)
                        {
                            consumer(disposition);
                        }
                    }
                })
                {
                }
        // TODO: The nunit code uses UnitTestAttributeCache
        public XunitPsiFileExplorer(XunitTestProvider provider, UnitTestElementFactory unitTestElementFactory,
                                    UnitTestElementLocationConsumer consumer, IFile file, 
                                    Func<bool> interrupted, SearchDomainFactory searchDomainFactory)
        {
            if (file == null)
                throw new ArgumentNullException("file");

            if (provider == null)
                throw new ArgumentNullException("provider");

            this.consumer = consumer;
            this.unitTestElementFactory = unitTestElementFactory;
            this.file = file;
            this.interrupted = interrupted;
            this.searchDomainFactory = searchDomainFactory;
            projectFile = file.GetSourceFile().ToProjectFile();
            project = file.GetProject();
            assemblyPath = project.GetOutputFilePath().FullPath;
        }
Ejemplo n.º 37
0
        public JasmineFileExplorer(JasmineElementFactory factory, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted, IEnumerable<IPsiSourceFile> referencedFiles)
        {
            _factory = factory;
            _consumer = consumer;
            _file = file;
            _interrupted = interrupted;

            _referencedFiles = (referencedFiles != null) ? (from f in referencedFiles
                where f.PrimaryPsiLanguage.IsExactly<JavaScriptLanguage>()
                select f.GetLocation().FullPath).ToArray<string>() : EmptyArray<string>.Instance;

            var element = file.GetSourceFile().ToProjectFile();
            if (element != null)
            {
                _filename = element.Location.FullPath;
            }

            _project = _file.GetProject();
            _projectFileEnvoy = ProjectModelElementEnvoy.Create(element);
        }
Ejemplo n.º 38
0
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile == null)
            {
                throw new ArgumentNullException("psiFile");
            }

            var project = psiFile.GetProject();

            if (project == null)
            {
                return;
            }

            if (IsSilverlightProject(project) && !IsAgUnitAvailable)
            {
                return;
            }

            psiFile.ProcessDescendants(new XunitPsiFileExplorer(provider, unitTestElementFactory, consumer, psiFile, interrupted, searchDomainFactory));
        }
Ejemplo n.º 39
0
        public JasmineFileExplorer(JasmineElementFactory factory, UnitTestElementLocationConsumer consumer, IFile file, CheckForInterrupt interrupted, IEnumerable <IPsiSourceFile> referencedFiles)
        {
            _factory     = factory;
            _consumer    = consumer;
            _file        = file;
            _interrupted = interrupted;

            _referencedFiles = (referencedFiles != null) ? (from f in referencedFiles
                                                            where f.PrimaryPsiLanguage.IsExactly <JavaScriptLanguage>()
                                                            select f.GetLocation().FullPath).ToArray <string>() : EmptyArray <string> .Instance;

            var element = file.GetSourceFile().ToProjectFile();

            if (element != null)
            {
                _filename = element.Location.FullPath;
            }

            _project          = _file.GetProject();
            _projectFileEnvoy = ProjectModelElementEnvoy.Create(element);
        }
Ejemplo n.º 40
0
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (interrupted())
            {
                return;
            }

            // don't bother going any further if there's isn't a project with a reference to the Fixie assembly
            var project = psiFile.GetProject();

            if (project == null)
            {
                return;
            }

            if (project.GetModuleReferences().All(module => module.Name != "Fixie"))
            {
                return;
            }

            psiFile.ProcessDescendants(new PsiFileExplorer(unitTestElementFactory, conventionCheck, consumer, psiFile, interrupted));
        }
        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (!xUnitInstalled)
                return;

            if (provider == null)
                return;

            if (psiFile == null)
                throw new ArgumentNullException("psiFile");

            var project = psiFile.GetProject();
            if (project == null)
                return;

            if (project.GetAssemblyReferences().Any(IsSilverlightMscorlib))
                return;

            var psiFileExplorer = (IRecursiveElementProcessor)Activator.CreateInstance(XunitPsiFileExplorerType,
                provider, consumer, psiFile, interrupted);

            psiFile.ProcessDescendants(psiFileExplorer);
        }
 // ReSharper 8.1 replaced CheckForInterrupt with Func<bool>
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     ExploreFile(psiFile, consumer, new Func<bool>(() => interrupted()));
 }
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, Func <bool> interrupted)
 {
     Explore(psiFile, x => consumer(x), () => !interrupted());
 }
Ejemplo n.º 44
0
                public ConsumerAdapter(GallioTestProvider provider, UnitTestElementLocationConsumer consumer, ITreeNode psiFile)
                    : this(provider, delegate(IUnitTestElement element)
                    {
                        var projectFile = psiFile.GetSourceFile().ToProjectFile();

                    	if (projectFile == null || !projectFile.IsValid()) 
							return;

                        consumer(element.GetDisposition());
                    })
                {
                }
Ejemplo n.º 45
0
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     _storEvilFileExplorer.ExploreFile(psiFile, consumer, interrupted);
 }
Ejemplo n.º 46
0
                public ConsumerAdapter(IUnitTestProvider provider, UnitTestElementLocationConsumer consumer, IFile psiFile)
                    : this(provider, delegate(UnitTestElement element)
                    {
#if RESHARPER_31
                        IProjectFile projectFile = psiFile.ProjectItem;
#else
                        IProjectFile projectFile = psiFile.ProjectFile;
#endif
                        if (projectFile.IsValid)
                        {
                            UnitTestElementDisposition disposition = element.GetDisposition();
                            if (disposition.Locations.Count != 0 && disposition.Locations[0].ProjectFile == projectFile)
                            {
                                consumer(disposition);
                            }
                        }
                    })
                {
                }
Ejemplo n.º 47
0
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     _storEvilFileExplorer.ExploreFile(psiFile, consumer, interrupted);
 }
Ejemplo n.º 48
0
            /// <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;
                    }
                }
            }
Ejemplo n.º 49
0
 // ReSharper 8.1 replaced CheckForInterrupt with Func<bool>
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     ExploreFile(psiFile, consumer, new Func <bool>(() => interrupted()));
 }
Ejemplo n.º 50
0
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
 }
Ejemplo n.º 51
0
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, Func<bool> interrupted)
 {
     Explore(psiFile, x => consumer(x), () => !interrupted());
 }
Ejemplo n.º 52
0
 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     Debug.WriteLine("ExploreFile " + psiFile.ProjectFile.Location);
 }