public AssemblyExplorer(MSpecUnitTestProvider provider,
#if RESHARPER_61
                                IUnitTestElementManager manager,
                                PsiModuleManager psiModuleManager,
                                CacheManager cacheManager,
#endif
                                IMetadataAssembly assembly,
                                IProject project,
                                UnitTestElementConsumer consumer)
        {
            _assembly = assembly;
            _consumer = consumer;

            using (ReadLockCookie.Create())
            {
                var projectEnvoy = new ProjectModelElementEnvoy(project);

                var cache = new ContextCache();
#if RESHARPER_61
                _contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, _assembly.Location.FullPath, cache);
                _contextSpecificationFactory  = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
                _behaviorFactory              = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
                _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy);
#else
#if RESHARPER_6
                _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location.FullPath, cache);
#else
                _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location, cache);
#endif
                _contextSpecificationFactory  = new ContextSpecificationFactory(provider, project, projectEnvoy, cache);
                _behaviorFactory              = new BehaviorFactory(provider, project, projectEnvoy, cache);
                _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, project, projectEnvoy);
#endif
            }
        }
        public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
                                                   , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
                                                   )
        {
            var projectId = parent.GetAttribute("projectId");
            var project   = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;

            if (project == null)
            {
                return(null);
            }

            var behavior = parentElement as BehaviorElement;

            if (behavior == null)
            {
                return(null);
            }

            var typeName   = parent.GetAttribute("typeName");
            var methodName = parent.GetAttribute("methodName");
            var isIgnored  = bool.Parse(parent.GetAttribute("isIgnored"));

            return(BehaviorSpecificationFactory.GetOrCreateBehaviorSpecification(provider,
#if RESHARPER_61
                                                                                 manager, psiModuleManager, cacheManager,
#endif
                                                                                 project, behavior, ProjectModelElementEnvoy.Create(project), typeName, methodName, isIgnored));
        }
示例#3
0
        public static IUnitTestElement ReadFromXml(XmlElement parent,
                                                   IUnitTestElement parentElement,
                                                   ISolution solution,
                                                   BehaviorSpecificationFactory factory)
        {
            var projectId = parent.GetAttribute("projectId");
            var project   = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;

            if (project == null)
            {
                return(null);
            }

            var behavior = parentElement as BehaviorElement;

            if (behavior == null)
            {
                return(null);
            }

            var typeName   = parent.GetAttribute("typeName");
            var methodName = parent.GetAttribute("methodName");
            var isIgnored  = bool.Parse(parent.GetAttribute("isIgnored"));

            return(factory.GetOrCreateBehaviorSpecification(behavior,
                                                            new ClrTypeName(typeName),
                                                            methodName,
                                                            isIgnored));
        }
        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 AssemblyExplorer(TestProvider provider,
#if RESHARPER_61
                            IUnitTestElementManager manager,
                            PsiModuleManager psiModuleManager,
                            CacheManager cacheManager,
#endif
                            IMetadataAssembly assembly,
                            IProject project,
                            UnitTestElementConsumer consumer)
    {
      _assembly = assembly;
      _consumer = consumer;

      using (ReadLockCookie.Create())
      {
        var projectEnvoy = new ProjectModelElementEnvoy(project);

        var cache = new ContextCache();
#if RESHARPER_61
        _contextFactory = new ContextFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, _assembly.Location.FullPath, cache);
        _contextSpecificationFactory = new ContextSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
        _behaviorFactory = new BehaviorFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy, cache);
        _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, manager, psiModuleManager, cacheManager, project, projectEnvoy);
#else
#if RESHARPER_6
        _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location.FullPath, cache);
#else
        _contextFactory = new ContextFactory(provider, project, projectEnvoy, _assembly.Location, cache);
#endif
        _contextSpecificationFactory = new ContextSpecificationFactory(provider, project, projectEnvoy, cache);
#endif
      }
    }
示例#6
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)
            };
        }
    public FileExplorer(TestProvider 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 =  PsiSourceFileExtensions.ToProjectFile(file.GetSourceFile()).GetProject();
#else
      resharper::JetBrains.ProjectModel.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);
#endif

      _elementHandlers = new List<IElementHandler>
                         {
                           new ContextElementHandler(contextFactory),
                           new ContextSpecificationElementHandler(contextSpecificationFactory),
                         };
    }
 public MSpecUnitTestElementSerializer(ISolution solution,
                                       MSpecUnitTestProvider provider,
                                       ContextFactory contextFactory,
                                       ContextSpecificationFactory contextSpecificationFactory,
                                       BehaviorFactory behaviorFactory,
                                       BehaviorSpecificationFactory behaviorSpecificationFactory)
 {
     _solution       = solution;
     _provider       = provider;
     _contextFactory = contextFactory;
     _contextSpecificationFactory  = contextSpecificationFactory;
     _behaviorFactory              = behaviorFactory;
     _behaviorSpecificationFactory = behaviorSpecificationFactory;
 }
示例#9
0
        public AssemblyExplorer(MSpecUnitTestProvider provider,
                                IMetadataAssembly assembly,
                                IProject project,
                                UnitTestElementConsumer consumer)
        {
            _provider = provider;
            _assembly = assembly;
            _project  = project;
            _consumer = consumer;

            var cache = new ContextCache();

            _contextFactory = new ContextFactory(_provider, _project, _assembly.Location, cache);
            _contextSpecificationFactory  = new ContextSpecificationFactory(_provider, _project, cache);
            _behaviorFactory              = new BehaviorFactory(_provider, _project, cache);
            _behaviorSpecificationFactory = new BehaviorSpecificationFactory(_provider, _project);
        }
        public AssemblyExplorer(MSpecUnitTestProvider provider,
                                IMetadataAssembly assembly,
                                IProject project,
                                UnitTestElementConsumer consumer)
        {
            _assembly = assembly;
            _consumer = consumer;

            using (ReadLockCookie.Create())
            {
                var projectEnvoy = new ProjectModelElementEnvoy(project);

                var cache = new ContextCache();
                _contextFactory = new ContextFactory(provider, projectEnvoy, _assembly.Location, cache);
                _contextSpecificationFactory  = new ContextSpecificationFactory(provider, projectEnvoy, cache);
                _behaviorFactory              = new BehaviorFactory(provider, projectEnvoy, cache);
                _behaviorSpecificationFactory = new BehaviorSpecificationFactory(provider, projectEnvoy);
            }
        }
示例#11
0
 public BehaviorElementHandler(ElementFactories factories)
 {
     this._factory = factories.Behaviors;
     this._behaviorSpecifications = factories.BehaviorSpecifications;
 }
示例#12
0
 public BehaviorElementHandler(BehaviorFactory behaviorFactory, BehaviorSpecificationFactory behaviorSpecificationFactory)
 {
     _factory = behaviorFactory;
     _behaviorSpecifications = behaviorSpecificationFactory;
 }