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 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 ElementFactories(ContextFactory contexts,
                         ContextSpecificationFactory contextSpecifications,
                         BehaviorFactory behaviors,
                         BehaviorSpecificationFactory behaviorSpecifications)
 {
   Contexts = contexts;
   ContextSpecifications = contextSpecifications;
   Behaviors = behaviors;
   BehaviorSpecifications = behaviorSpecifications;
 }
    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 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;
 }
    public AssemblyExplorer(MSpecUnitTestProvider provider,
                            IMetadataAssembly assembly,
                            IProject project,
                            UnitTestElementConsumer consumer)
    {
      _provider = provider;
      _assembly = assembly;
      _project = project;
      _consumer = consumer;

      _contextFactory = new ContextFactory(_provider, _project, _assembly.Location);
      _contextSpecificationFactory = new ContextSpecificationFactory(_provider, _project);
      _behaviorFactory = new BehaviorFactory(_provider, _project);
      _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);
      }
    }
    public static IUnitTestElement ReadFromXml(XmlElement parent,
                                               ISolution solution,
                                               ContextFactory factory)
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

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

      return factory.GetOrCreateContext(assemblyLocation,
                                        project,
                                        new ClrTypeName(typeName),
                                        subject,
                                        EmptyArray<string>.Instance,
                                        isIgnored);
    }
 public ContextElementHandler(ContextFactory contextFactory)
 {
     _contextFactory = contextFactory;
 }
 public ContextElementHandler(ElementFactories factories)
 {
   _factory = factories.Contexts;
 }