예제 #1
0
 public SilverlightElementsSource(
     SilverlightUnitTestProvider provider, 
     IMsTestServices msTestServices, 
     IMsTestAttributesProvider msTestAttributesProvider, IUnitTestElementManager unitTestElementManager, IUnitTestCategoryFactory unitTestCategoryFactory, IShellLocks shellLocks)
     : base(provider, msTestServices, msTestAttributesProvider, unitTestElementManager, unitTestCategoryFactory, shellLocks)
 {
 }
        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 typeName         = parent.GetAttribute("typeName");
            var assemblyLocation = parent.GetAttribute("assemblyLocation");
            var isIgnored        = bool.Parse(parent.GetAttribute("isIgnored"));
            var subject          = parent.GetAttribute("subject");

            return(ContextFactory.GetOrCreateContextElement(provider,
#if RESHARPER_61
                                                            manager, psiModuleManager, cacheManager,
#endif
                                                            project,
                                                            ProjectModelElementEnvoy.Create(project),
                                                            typeName,
                                                            assemblyLocation,
                                                            subject,
                                                            EmptyArray <string> .Instance,
                                                            isIgnored));
        }
    public static ContextSpecificationElement GetOrCreateContextSpecification(MSpecUnitTestProvider provider,
                                                                              IUnitTestElementManager manager,
                                                                              PsiModuleManager psiModuleManager,
                                                                              CacheManager cacheManager,
                                                                              IProject project,
                                                                              ContextElement context,
                                                                              ProjectModelElementEnvoy projectEnvoy,
                                                                              IClrTypeName declaringTypeName,
                                                                              string fieldName,
                                                                              bool isIgnored)
    {
      var id = ContextSpecificationElement.CreateId(context, fieldName);
      var contextSpecification = manager.GetElementById(project, id) as ContextSpecificationElement;
      if (contextSpecification != null)
      {
        contextSpecification.Parent = context;
        contextSpecification.State = UnitTestElementState.Valid;
        return contextSpecification;
      }

      return new ContextSpecificationElement(provider,
                                             psiModuleManager,
                                             cacheManager,
                                             context,
                                             projectEnvoy,
                                             declaringTypeName,
                                             fieldName,
                                             isIgnored);
    }
        public static ContextSpecificationElement GetOrCreateContextSpecification(MSpecUnitTestProvider provider,
                                                                                  IUnitTestElementManager manager,
                                                                                  PsiModuleManager psiModuleManager,
                                                                                  CacheManager cacheManager,
                                                                                  IProject project,
                                                                                  ContextElement context,
                                                                                  ProjectModelElementEnvoy projectEnvoy,
                                                                                  IClrTypeName declaringTypeName,
                                                                                  string fieldName,
                                                                                  bool isIgnored)
        {
            var id = ContextSpecificationElement.CreateId(context, fieldName);
            var contextSpecification = manager.GetElementById(project, id) as ContextSpecificationElement;

            if (contextSpecification != null)
            {
                contextSpecification.Parent = context;
                contextSpecification.State  = UnitTestElementState.Valid;
                return(contextSpecification);
            }

            return(new ContextSpecificationElement(provider,
                                                   psiModuleManager,
                                                   cacheManager,
                                                   context,
                                                   projectEnvoy,
                                                   declaringTypeName,
                                                   fieldName,
                                                   isIgnored));
        }
예제 #5
0
        public UnityNUnitServiceProvider(ISolution solution,
                                         IPsiModules psiModules,
                                         ISymbolCache symbolCache,
                                         IUnitTestElementIdFactory idFactory,
                                         IUnitTestElementManager elementManager,
                                         NUnitTestProvider provider,
                                         IUnitTestingSettings settings,
                                         ISettingsStore settingsStore,
                                         ISettingsOptimization settingsOptimization,
                                         ISettingsCache settingsCache,
                                         UnitTestingCachingService cachingService,
                                         INUnitTestParametersProvider testParametersProvider,
                                         UnityEditorProtocol editorProtocol,
                                         RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                         UnitySolutionTracker unitySolutionTracker)
            : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settings, settingsStore,
                   settingsOptimization, settingsCache, cachingService, testParametersProvider)
        {
            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myRdUnityModel         = solution.GetProtocolSolution().GetRdUnityModel();
            myEditorProtocol       = editorProtocol;
            myUnityEditorStrategy  = runViaUnityEditorStrategy;
            myUnitySolutionTracker = unitySolutionTracker;
        }
    public static BehaviorSpecificationElement GetOrCreateBehaviorSpecification(MSpecUnitTestProvider provider,
                                                                                IUnitTestElementManager manager,
                                                                                PsiModuleManager psiModuleManager,
                                                                                CacheManager cacheManager,
                                                                                IProject project,
                                                                                BehaviorElement behavior,
                                                                                ProjectModelElementEnvoy projectEnvoy,
                                                                                IClrTypeName declaringTypeName,
                                                                                string fieldName,
                                                                                bool isIgnored)
    {
      var id = BehaviorSpecificationElement.CreateId(behavior, fieldName);
      var behaviorSpecification = manager.GetElementById(project, id) as BehaviorSpecificationElement;
      if (behaviorSpecification != null)
      {
        behaviorSpecification.Parent = behavior;
        behaviorSpecification.State = UnitTestElementState.Valid;
        return behaviorSpecification;
      }

      return new BehaviorSpecificationElement(provider,
                                              psiModuleManager,
                                              cacheManager,
                                              behavior,
                                              projectEnvoy,
                                              declaringTypeName,
                                              fieldName,
                                              isIgnored);
    }
예제 #7
0
        public UnityNUnitServiceProvider(ISolution solution,
                                         IPsiModules psiModules,
                                         ISymbolCache symbolCache,
                                         IUnitTestElementIdFactory idFactory,
                                         IUnitTestElementManager elementManager,
                                         NUnitTestProvider provider,
                                         IUnitTestingSettings settings,
                                         ISettingsStore settingsStore,
                                         ISettingsOptimization settingsOptimization,
                                         ISettingsCache settingsCache,
                                         UnitTestingCachingService cachingService,
                                         INUnitTestParametersProvider testParametersProvider,
                                         FrontendBackendHost frontendBackendHost,
                                         BackendUnityHost backendUnityHost,
                                         RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                         UnitySolutionTracker unitySolutionTracker)
            : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settings, settingsStore,
                   settingsOptimization, settingsCache, cachingService, testParametersProvider)
        {
            // Only in tests
            if (!frontendBackendHost.IsAvailable)
            {
                return;
            }

            myFrontendBackendModel = frontendBackendHost.Model.NotNull("frontendBackendHost.Model != null");
            myBackendUnityHost     = backendUnityHost;
            myUnityEditorStrategy  = runViaUnityEditorStrategy;
            myUnitySolutionTracker = unitySolutionTracker;
        }
        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));
        }
    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 context = parentElement as ContextElement;
      if (context == null)
      {
        return null;
      }

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

      return ContextSpecificationFactory.GetOrCreateContextSpecification(provider,
#if RESHARPER_61
                manager, psiModuleManager, cacheManager,
#endif
                project, context, ProjectModelElementEnvoy.Create(project), new ClrTypeName(typeName), methodName, EmptyArray<string>.Instance, isIgnored);
    }
        protected Element(MSpecUnitTestProvider provider,
                          Element parent,
                          IClrTypeName declaringTypeName,
                          UnitTestingCachingService cachingService,
                          IUnitTestElementManager elementManager,
                          bool isIgnored)
        {
            if (declaringTypeName == null)
            {
                throw new ArgumentNullException("declaringTypeName");
            }

            this._provider          = provider;
            this._declaringTypeName = declaringTypeName;
            this._cachingService    = cachingService;
            this._elementManager    = elementManager;

            if (isIgnored)
            {
                this.ExplicitReason = "Ignored";
            }

            this.Parent = parent;

            this.Children     = new BindableCollection <IUnitTestElement>(UT.Locks.ReadLock);
            this._taskFactory = new UnitTestTaskFactory(this._provider.ID);
        }
예제 #11
0
        public static BehaviorElement GetOrCreateBehavior(MSpecUnitTestProvider provider,
                                                          IUnitTestElementManager manager,
                                                          PsiModuleManager psiModuleManager,
                                                          CacheManager cacheManager,
                                                          IProject project,
                                                          ProjectModelElementEnvoy projectEnvoy,
                                                          ContextElement context,
                                                          IClrTypeName declaringTypeName,
                                                          string fieldName,
                                                          bool isIgnored,
                                                          string fieldType)
        {
            var id       = BehaviorElement.CreateId(context, fieldType, fieldName);
            var behavior = manager.GetElementById(project, id) as BehaviorElement;

            if (behavior != null)
            {
                behavior.Parent = context;
                behavior.State  = UnitTestElementState.Valid;
                return(behavior);
            }

            return(new BehaviorElement(provider,
                                       psiModuleManager,
                                       cacheManager,
                                       context,
                                       projectEnvoy,
                                       declaringTypeName,
                                       fieldName,
                                       isIgnored,
                                       fieldType));
        }
        public static ContextElement GetOrCreateContext(MSpecUnitTestProvider provider,
                                                        IUnitTestElementManager manager,
                                                        PsiModuleManager psiModuleManager,
                                                        CacheManager cacheManager,
                                                        IProject project,
                                                        ProjectModelElementEnvoy projectEnvoy,
                                                        IClrTypeName typeName,
                                                        string assemblyLocation,
                                                        string subject,
                                                        ICollection <string> tags,
                                                        bool isIgnored)
        {
            var id             = ContextElement.CreateId(subject, typeName.FullName, tags);
            var contextElement = manager.GetElementById(project, id) as ContextElement;

            if (contextElement != null)
            {
                contextElement.State = UnitTestElementState.Valid;
                return(contextElement);
            }

            return(new ContextElement(provider,
                                      psiModuleManager,
                                      cacheManager,
                                      projectEnvoy,
                                      typeName,
                                      assemblyLocation,
                                      subject,
                                      tags,
                                      isIgnored));
        }
예제 #13
0
        public static BehaviorSpecificationElement GetOrCreateBehaviorSpecification(MSpecUnitTestProvider provider,
                                                                                    IUnitTestElementManager manager,
                                                                                    PsiModuleManager psiModuleManager,
                                                                                    CacheManager cacheManager,
                                                                                    IProject project,
                                                                                    BehaviorElement behavior,
                                                                                    ProjectModelElementEnvoy projectEnvoy,
                                                                                    IClrTypeName declaringTypeName,
                                                                                    string fieldName,
                                                                                    bool isIgnored)
        {
            var id = BehaviorSpecificationElement.CreateId(behavior, fieldName);
            var behaviorSpecification = manager.GetElementById(project, id) as BehaviorSpecificationElement;

            if (behaviorSpecification != null)
            {
                behaviorSpecification.Parent = behavior;
                behaviorSpecification.State  = UnitTestElementState.Valid;
                return(behaviorSpecification);
            }

            return(new BehaviorSpecificationElement(provider,
                                                    psiModuleManager,
                                                    cacheManager,
                                                    behavior,
                                                    projectEnvoy,
                                                    declaringTypeName,
                                                    fieldName,
                                                    isIgnored));
        }
예제 #14
0
 protected override IMsTestElementFactory CreateMsTestElementFactory(
     SilverlightServices silverlightServices,
     IUnitTestElementManager unitTestElementManager,
     IUnitTestCategoryFactory unitTestCategoryFactory)
 {
     return new MsTestElementFactory(silverlightServices, unitTestElementManager, unitTestCategoryFactory);
 }
        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);
    }
 public SimpleTestingElementFactory(SimpleTestingTestProvider provider, IUnitTestElementManager unitTestManager, CacheManager cacheManager, PsiModuleManager psiModuleManager)
 {
     _provider = provider;
     _unitTestManager = unitTestManager;
     _cacheManager = cacheManager;
     _psiModuleManager = psiModuleManager;
 }
    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
      }
    }
예제 #19
0
 public MSpecUnitTestElementSerializer(ISolution solution, MSpecUnitTestProvider provider, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager)
 {
     _solution         = solution;
     _provider         = provider;
     _manager          = manager;
     _psiModuleManager = psiModuleManager;
     _cacheManager     = cacheManager;
 }
 public MSpecUnitTestElementSerializer(ISolution solution, MSpecUnitTestProvider provider, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager)
 {
   _solution = solution;
   _provider = provider;
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;
 }
예제 #21
0
 public UnityTestsExploration(UnitTestAttributeCache unitTestAttributeCache, IProject project,
                              IUnitTestElementsObserver observer, IUnitTestElementIdFactory unitTestElementIdFactory,
                              UnityTestProvider unityTestProvider, IUnitTestElementManager unitTestElementManager, UnityNUnitServiceProvider serviceProvider)
 {
     myUnitTestAttributeCache = unitTestAttributeCache;
     myProject           = project;
     myUnitTestCollector = observer;
     myElementFactory    = new UnityTestElementFactory(unitTestElementIdFactory, unityTestProvider, unitTestElementManager, serviceProvider);
 }
 public BehaviorSpecificationFactory(MSpecUnitTestProvider provider,
                                     IUnitTestElementManager manager,
                                     UnitTestingCachingService cachingService,
                                     IUnitTestElementIdFactory elementIdFactory)
 {
     this._elementIdFactory = elementIdFactory;
     this._provider         = provider;
     _manager        = manager;
     _cachingService = cachingService;
 }
 public MSpecTestMetadataExplorer(MSpecUnitTestProvider provider,
                                  IUnitTestElementManager manager,
                                  PsiModuleManager psiModuleManager,
                                  CacheManager cacheManager)
 {
     _manager          = manager;
     _psiModuleManager = psiModuleManager;
     _cacheManager     = cacheManager;
     _provider         = provider;
 }
 public MSpecTestMetadataExplorer(MSpecUnitTestProvider provider,
                                  IUnitTestElementManager manager,
                                  PsiModuleManager psiModuleManager,
                                  CacheManager cacheManager)
 {
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;
   _provider = provider;
 }
예제 #25
0
 public BehaviorSpecificationFactory(MSpecUnitTestProvider provider,
                                     IUnitTestElementManager manager,
                                     IPsi psiModuleManager,
                                     ICache cacheManager)
 {
     this._manager          = manager;
     this._psiModuleManager = psiModuleManager;
     this._cacheManager     = cacheManager;
     this._provider         = provider;
 }
 public BehaviorSpecificationFactory(MSpecUnitTestProvider provider,
                                     IUnitTestElementManager manager,
                                     IPsi psiModuleManager,
                                     ICache cacheManager)
 {
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;
   _provider = provider;
 }
예제 #27
0
 public UnityTestElementFactory(IUnitTestElementIdFactory unitTestElementIdFactory,
                                UnityTestProvider unityTestProvider,
                                IUnitTestElementManager elementManager, UnityNUnitServiceProvider serviceProvider)
 {
     myUnitTestElementIdFactory = unitTestElementIdFactory;
     myElementManager           = elementManager;
     myServiceProvider          = serviceProvider;
     myElements         = new WeakToWeakDictionary <UnitTestElementId, IUnitTestElement>();
     myUnitTestProvider = unityTestProvider;
 }
예제 #28
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)
            };
        }
예제 #29
0
 public TestElementFactory(ITestProvider testProvider, IUnitTestElementManager unitTestElementManager, IUnitTestElementIdFactory unitTestElementIdFactory)
 {
     _testProvider             = testProvider;
     _unitTestElementManager   = unitTestElementManager;
     _unitTestElementIdFactory = unitTestElementIdFactory;
     _factoryMethods           = new Dictionary <string, Func <ITestEntity, IUnitTestElement> >
     {
         { typeof(ClassTestElement).FullName, GetOrCreateClassTestElementRecursively },
         { typeof(ChildTestElement).FullName, GetOrCreateChildTest }
     };
 }
 protected FieldElement(MSpecUnitTestProvider provider,
                        Element parent,
                        IClrTypeName declaringTypeName,
                        UnitTestingCachingService cachingService,
                        IUnitTestElementManager elementManager,
                        string fieldName,
                        bool isIgnored)
     : base(provider, parent, declaringTypeName, cachingService, elementManager, isIgnored || parent.Explicit)
 {
     this._fieldName = fieldName;
 }
    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 ContextSpecificationFactory(MSpecUnitTestProvider provider,
                                    IUnitTestElementManager manager,
                                    IPsi psiModuleManager,
                                    ICache cacheManager,
                                    ElementCache cache)
 {
     this._manager = manager;
     this._psiModuleManager = psiModuleManager;
     this._cacheManager = cacheManager;
     this._provider = provider;
     this._cache = cache;
 }
 public BehaviorFactory(MSpecUnitTestProvider provider,
                        IUnitTestElementManager manager,
                        IPsi psiModuleManager,
                        ICache cacheManager,
                        ElementCache cache)
 {
     _psiModuleManager = psiModuleManager;
     _cacheManager     = cacheManager;
     _provider         = provider;
     _cache            = cache;
     _manager          = manager;
 }
예제 #34
0
 public ContextSpecificationFactory(MSpecUnitTestProvider provider,
                                    IUnitTestElementManager manager,
                                    IPsi psiModuleManager,
                                    ICache cacheManager,
                                    ElementCache cache)
 {
     _manager          = manager;
     _psiModuleManager = psiModuleManager;
     _cacheManager     = cacheManager;
     _provider         = provider;
     _cache            = cache;
 }
예제 #35
0
 // ReSharper disable once SuggestBaseTypeForParameter
 public XunitServiceProvider(XunitTestProvider provider,
                             IUnitTestElementManager elementManager,
                             IUnitTestElementIdFactory elementIdFactory,
                             IUnitTestElementCategoryFactory categoryFactory,
                             UnitTestingCachingService cachingService)
 {
     this.elementIdFactory = elementIdFactory;
     CachingService        = cachingService;
     ElementManager        = elementManager;
     CategoryFactory       = categoryFactory;
     Provider = provider;
 }
 // ReSharper disable once SuggestBaseTypeForParameter
 public XunitServiceProvider(XunitTestProvider provider,
                             IUnitTestElementManager elementManager,
                             IUnitTestElementIdFactory elementIdFactory,
                             IUnitTestElementCategoryFactory categoryFactory,
                             UnitTestingCachingService cachingService)
 {
     this.elementIdFactory = elementIdFactory;
     CachingService = cachingService;
     ElementManager = elementManager;
     CategoryFactory = categoryFactory;
     Provider = provider;
 }
 public BehaviorSpecificationFactory(MSpecUnitTestProvider provider,
                                     IUnitTestElementManager manager,
                                     IPsi psiModuleManager,
                                     ICache cacheManager,
                                     IUnitTestElementIdFactory elementIdFactory)
 {
     this._manager = manager;
     this._psiModuleManager = psiModuleManager;
     this._cacheManager = cacheManager;
     this._elementIdFactory = elementIdFactory;
     this._provider = provider;
 }
예제 #38
0
 public ContextSpecificationFactory(MSpecUnitTestProvider provider,
                                    IUnitTestElementManager manager,
                                    IUnitTestElementIdFactory elementIdFactory,
                                    UnitTestingCachingService cachingService,
                                    ElementCache cache)
 {
     this._manager          = manager;
     this._elementIdFactory = elementIdFactory;
     this._cachingService   = cachingService;
     this._provider         = provider;
     this._cache            = cache;
 }
 public ContextFactory(MSpecUnitTestProvider provider,
                       IUnitTestElementManager manager,
                       IPsi psiModuleManager,
                       ICache cacheManager,
                       ElementCache cache)
 {
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;
   _provider = provider;
   _cache = cache;
 }
 public SilverlightMsTestMetadataExplorer(IShellLocks shellLocks, ISettingsStore settingsStore, SilverlightUnitTestProvider provider, Lifetime lifetime, ISolution solution, 
     IUnitTestElementManager unitTestElementManager, mstestlegacy::JetBrains.ReSharper.UnitTestProvider.MSTest.IMsTestElementFactory elementFactory, 
     IMainWindow mainWindow, IApplicationDescriptor applicationDescriptor)
 {
     Provider = provider;
     msTestAttributesProvider = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestAttributesProvider();
     var msTestProvider = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestProvider(shellLocks, settingsStore, msTestAttributesProvider, mainWindow, applicationDescriptor);
     var msTestServices = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestServices(lifetime, solution, msTestProvider, settingsStore);
     msTestElementFactory = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestElementFactory(msTestServices, unitTestElementManager);
     this.shellLocks = shellLocks;
     this.elementFactory = elementFactory;
 }
 public BehaviorFactory(MSpecUnitTestProvider provider,
                      IUnitTestElementManager manager,
                      IPsi psiModuleManager,
                      ICache cacheManager,
                      ElementCache cache)
 {
     this._psiModuleManager = psiModuleManager;
     this._cacheManager = cacheManager;
     this._provider = provider;
     this._cache = cache;
     this._manager = manager;
 }
 public UnityNUnitServiceProvider(ISolution solution, IPsiModules psiModules, ISymbolCache symbolCache,
                                  IUnitTestElementIdFactory idFactory, IUnitTestElementManager elementManager, NUnitTestProvider provider,
                                  ISettingsStore settingsStore, ISettingsOptimization settingsOptimization, ISettingsCache settingsCache,
                                  UnitTestingCachingService cachingService, IDotNetCoreSdkResolver dotNetCoreSdkResolver,
                                  UnityEditorProtocol unityEditorProtocol,
                                  RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                  NUnitOutOfProcessUnitTestRunStrategy nUnitOutOfProcessUnitTestRunStrategy)
     : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settingsStore,
            settingsOptimization, settingsCache, cachingService, dotNetCoreSdkResolver, nUnitOutOfProcessUnitTestRunStrategy)
 {
     myUnityEditorProtocol = unityEditorProtocol;
     myUnityEditorStrategy = runViaUnityEditorStrategy;
 }
        public SilverlightMsTestMetadataExplorer(IShellLocks shellLocks, ISettingsStore settingsStore, SilverlightUnitTestProvider provider, Lifetime lifetime, ISolution solution,
                                                 IUnitTestElementManager unitTestElementManager, mstestlegacy::JetBrains.ReSharper.UnitTestProvider.MSTest.IMsTestElementFactory elementFactory,
                                                 IMainWindow mainWindow, IApplicationDescriptor applicationDescriptor)
        {
            Provider = provider;
            msTestAttributesProvider = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestAttributesProvider();
            var msTestProvider = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestProvider(shellLocks, settingsStore, msTestAttributesProvider, mainWindow, applicationDescriptor);
            var msTestServices = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestServices(lifetime, solution, msTestProvider, settingsStore);

            msTestElementFactory = new mstest10::JetBrains.ReSharper.UnitTestProvider.MSTest10.MsTestElementFactory(msTestServices, unitTestElementManager);
            this.shellLocks      = shellLocks;
            this.elementFactory  = elementFactory;
        }
 public ContextFactory(MSpecUnitTestProvider provider,
                       IUnitTestElementManager manager,
                       IUnitTestCategoryFactory categoryFactory,
                       IPsi psiModuleManager,
                       ICache cacheManager,
                       ElementCache cache)
 {
     this._manager          = manager;
     this._categoryFactory  = categoryFactory;
     this._psiModuleManager = psiModuleManager;
     this._cacheManager     = cacheManager;
     this._provider         = provider;
     this._cache            = cache;
 }
예제 #45
0
 public BehaviorSpecificationFactory(MSpecUnitTestProvider provider,
                                     IUnitTestElementManager manager,
                                     PsiModuleManager psiModuleManager,
                                     CacheManager cacheManager,
                                     IProject project,
                                     ProjectModelElementEnvoy projectEnvoy)
 {
     _manager          = manager;
     _psiModuleManager = psiModuleManager;
     _cacheManager     = cacheManager;
     _provider         = provider;
     _project          = project;
     _projectEnvoy     = projectEnvoy;
 }
 public BehaviorSpecificationFactory(MSpecUnitTestProvider provider,
                                     IUnitTestElementManager manager,
                                     PsiModuleManager psiModuleManager,
                                     CacheManager cacheManager,
                                     IProject project,
                                     ProjectModelElementEnvoy projectEnvoy)
 {
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;
   _provider = provider;
   _project = project;
   _projectEnvoy = projectEnvoy;
 }
 public UnityTestsSourceExplorer([NotNull] ISolution solution, [NotNull] UnityTestProvider provider, ClrLanguagesKnown clrLanguagesKnown,
                                 [NotNull] AssemblyToAssemblyReferencesResolveManager resolveManager, IUnitTestElementIdFactory idFactory,
                                 [NotNull] ResolveContextManager resolveContextManager, [NotNull] ILogger logger,
                                 UnitTestAttributeCache unitTestAttributeCache, IUnitTestElementIdFactory unitTestElementIdFactory, IUnitTestElementManager unitTestElementManager, UnityNUnitServiceProvider serviceProvider)
     : base(solution, provider, resolveManager, resolveContextManager, logger)
 {
     myClrLanguagesKnown        = clrLanguagesKnown;
     myIdFactory                = idFactory;
     myLogger                   = logger;
     myUnitTestAttributeCache   = unitTestAttributeCache;
     myUnitTestElementIdFactory = unitTestElementIdFactory;
     myUnityTestProvider        = provider;
     myUnitTestElementManager   = unitTestElementManager;
     myServiceProvider          = serviceProvider;
 }
예제 #48
0
 public TestElementFactory(
 ITestProvider testProvider,
 IUnitTestElementManager unitTestElementManager,
 IUnitTestElementIdFactory unitTestElementIdFactory,
 IUnitTestElementCategoryFactory unitTestElementCategoryFactory)
 {
     _testProvider = testProvider;
       _unitTestElementManager = unitTestElementManager;
       _unitTestElementIdFactory = unitTestElementIdFactory;
       _unitTestElementCategoryFactory = unitTestElementCategoryFactory;
       _factoryMethods = new Dictionary<string, Func<ITestEntity, IUnitTestElement>>
                 {
                     { typeof (ClassTestElement).FullName, GetOrCreateClassTestElementRecursively },
                     { typeof (ChildTestElement).FullName, GetOrCreateChildTest }
                 };
 }
 public ContextFactory(MSpecUnitTestProvider provider,
                       IUnitTestElementManager manager,
                       IUnitTestElementIdFactory elementIdFactory,
                       IUnitTestCategoryFactory categoryFactory,
                       IPsi psiModuleManager,
                       ICache cacheManager,
                       ElementCache cache)
 {
     this._manager = manager;
     this._elementIdFactory = elementIdFactory;
     this._categoryFactory = categoryFactory;
     this._psiModuleManager = psiModuleManager;
     this._cacheManager = cacheManager;
     this._provider = provider;
     this._cache = cache;
 }
예제 #50
0
 protected SilverlightElementsSourceBase(
     SilverlightUnitTestProvider provider,
     IMsTestServices msTestServices,
     IMsTestAttributesProvider msTestAttributesProvider,
     IUnitTestElementManager unitTestElementManager,
     IUnitTestCategoryFactory unitTestCategoryFactory,
     IShellLocks shellLocks)
 {
     this.Provider = provider;
     this.msTestServices = msTestServices;
     this.msTestAttributesProvider = msTestAttributesProvider;
     this.unitTestElementManager = unitTestElementManager;
     this.unitTestCategoryFactory = unitTestCategoryFactory;
     this.shellLocks = shellLocks;
     this.metadataElementsSource = new MetadataElementsSource(Logger.GetLogger(typeof(SilverlightElementsSourceBase)), shellLocks);
 }
        public static ContextElement GetOrCreateContextElement(MSpecUnitTestProvider provider,
#if RESHARPER_61
                                                               IUnitTestElementManager manager,
                                                               PsiModuleManager psiModuleManager,
                                                               CacheManager cacheManager,
#endif
                                                               IProject project,
                                                               ProjectModelElementEnvoy projectEnvoy,
                                                               string typeName,
                                                               string assemblyLocation,
                                                               string subject,
                                                               ICollection <string> tags,
                                                               bool isIgnored)
        {
#if RESHARPER_6
            var id = ContextElement.CreateId(subject, typeName);
#if RESHARPER_61
            var contextElement = manager.GetElementById(project, id) as ContextElement;
#else
            var contextElement = provider.UnitTestManager.GetElementById(project, id) as ContextElement;
#endif
            if (contextElement != null)
            {
                contextElement.State = UnitTestElementState.Valid;
                return(contextElement);
            }
#endif

            return(new ContextElement(provider,
#if RESHARPER_6
#if RESHARPER_61
                                      psiModuleManager,
                                      cacheManager,
#else
                                      provider.PsiModuleManager,
                                      provider.CacheManager,
#endif
#endif
                                      projectEnvoy,
                                      typeName,
                                      assemblyLocation,
                                      subject,
                                      tags,
                                      isIgnored));
        }
 public ContextFactory(MSpecUnitTestProvider provider,
                       IUnitTestElementManager manager,
                       PsiModuleManager psiModuleManager,
                       CacheManager cacheManager,
                       IProject project,
                       ProjectModelElementEnvoy projectEnvoy,
                       string assemblyPath,
                       ElementCache cache)
 {
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;
   _provider = provider;
   _cache = cache;
   _project = project;
   _projectEnvoy = projectEnvoy;
   _assemblyPath = assemblyPath;
 }
 public ContextSpecificationElement(MSpecUnitTestProvider provider,
                                    UnitTestElementId id,
                                    ContextElement context,
                                    IClrTypeName declaringTypeName,
                                    UnitTestingCachingService cachingService,
                                    IUnitTestElementManager elementManager,
                                    string fieldName,
                                    bool isIgnored)
     : base(provider,
            context,
            declaringTypeName,
            cachingService,
            elementManager,
            fieldName,
            isIgnored || context.Explicit)
 {
     this._id = id;
 }
    public static BehaviorElement GetOrCreateBehavior(MSpecUnitTestProvider provider,
#if RESHARPER_61
                                                      IUnitTestElementManager manager,
                                                      PsiModuleManager psiModuleManager,
                                                      CacheManager cacheManager,
#endif
                                                      IProject project,
                                                      ProjectModelElementEnvoy projectEnvoy,
                                                      ContextElement context,
                                                      IClrTypeName declaringTypeName,
                                                      string fieldName,
                                                      bool isIgnored,
                                                      string fullyQualifiedTypeName)
    {
      var id = BehaviorElement.CreateId(context, fieldName);
#if RESHARPER_61
      var behavior = manager.GetElementById(project, id) as BehaviorElement;
#else
      var behavior = provider.UnitTestManager.GetElementById(project, id) as BehaviorElement;
#endif
      if (behavior != null)
      {
        behavior.Parent = context;
        behavior.State = UnitTestElementState.Valid;
        return behavior;
      }

      return new BehaviorElement(provider,
#if RESHARPER_61
                                 psiModuleManager, cacheManager, 
#else
                                 provider.PsiModuleManager, provider.CacheManager,
#endif
                                 context,
                                 projectEnvoy,
                                 declaringTypeName,
                                 fieldName,
                                 isIgnored,
                                 fullyQualifiedTypeName);
    }
예제 #55
0
		public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement,
		                                           TestProvider 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 typeName = parent.GetAttribute("typeName");
			var assemblyLocation = parent.GetAttribute("assemblyLocation");
			
			return ContextFactory.GetOrCreateContextElement(provider,
#if RESHARPER_61
                                                      manager, psiModuleManager, cacheManager,
#endif
			                                                project, ProjectModelElementEnvoy.Create(project), typeName,
			                                                assemblyLocation);
		}
 public JasmineElementFactory(KarmaServiceProvider provider, IUnitTestElementManager unitTestElementManager)
 {
     _provider = provider;
     _unitTestElementManager = unitTestElementManager;
 }
    public static ContextSpecificationElement GetOrCreateContextSpecification(MSpecUnitTestProvider provider,
#if RESHARPER_61
                                                                              IUnitTestElementManager manager,
                                                                              PsiModuleManager psiModuleManager,
                                                                              CacheManager cacheManager,
#endif
                                                                              IProject project,
                                                                              ContextElement context,
                                                                              ProjectModelElementEnvoy projectEnvoy,
                                                                              IClrTypeName declaringTypeName,
                                                                              string fieldName,
                                                                              ICollection<string> tags,
                                                                              bool isIgnored)
    {
      var id = ContextSpecificationElement.CreateId(context, fieldName);
#if RESHARPER_61
      var contextSpecification = manager.GetElementById(project, id) as ContextSpecificationElement;
#else
      var contextSpecification = provider.UnitTestManager.GetElementById(project, id) as ContextSpecificationElement;
#endif
      if (contextSpecification != null)
      {
        contextSpecification.Parent = context;
        contextSpecification.State = UnitTestElementState.Valid;
        return contextSpecification;
      }

      return new ContextSpecificationElement(provider,
#if RESHARPER_61
                                 psiModuleManager, cacheManager, 
#else
                                 provider.PsiModuleManager, provider.CacheManager,
#endif
                                             context,
                                             projectEnvoy,
                                             declaringTypeName,
                                             fieldName,
                                             tags,
                                             isIgnored);
    }
    public static ContextElement GetOrCreateContextElement(MSpecUnitTestProvider provider,
#if RESHARPER_61
                                                           IUnitTestElementManager manager,
                                                           PsiModuleManager psiModuleManager,
                                                           CacheManager cacheManager,
#endif
                                                           IProject project,
                                                           ProjectModelElementEnvoy projectEnvoy,
                                                           string typeName,
                                                           string assemblyLocation,
                                                           string subject,
                                                           ICollection<string> tags,
                                                           bool isIgnored)
    {
      var id = ContextElement.CreateId(subject, typeName, tags);
#if RESHARPER_61
      var contextElement = manager.GetElementById(project, id) as ContextElement;
#else
      var contextElement = provider.UnitTestManager.GetElementById(project, id) as ContextElement;
#endif
      if (contextElement != null)
      {
        contextElement.State = UnitTestElementState.Valid;
        return contextElement;
      }

      return new ContextElement(provider,
#if RESHARPER_61
                                psiModuleManager,
                                cacheManager,
#else
                                provider.PsiModuleManager,
                                provider.CacheManager,
#endif                
                                projectEnvoy,
                                typeName,
                                assemblyLocation,
                                subject,
                                tags,
                                isIgnored);
    }
    public static BehaviorSpecificationElement GetOrCreateBehaviorSpecification(MSpecUnitTestProvider provider,
#if RESHARPER_61
                                                                                IUnitTestElementManager manager,
                                                                                PsiModuleManager psiModuleManager,
                                                                                CacheManager cacheManager,
#endif
                                                                                IProject project,
                                                                                BehaviorElement behavior,
                                                                                ProjectModelElementEnvoy projectEnvoy,
                                                                                string declaringTypeName,
                                                                                string fieldName,
                                                                                bool isIgnored)
    {
#if RESHARPER_6
      var id = BehaviorSpecificationElement.CreateId(behavior.Id, fieldName);
#if RESHARPER_61
      var behaviorSpecification = manager.GetElementById(project, id) as BehaviorSpecificationElement;
#else
      var behaviorSpecification = provider.UnitTestManager.GetElementById(project, id) as BehaviorSpecificationElement;
#endif
      if (behaviorSpecification != null)
      {
        behaviorSpecification.Parent = behavior;
        behaviorSpecification.State = UnitTestElementState.Valid;
        return behaviorSpecification;
      }
#endif

      return new BehaviorSpecificationElement(provider,
#if RESHARPER_6
#if RESHARPER_61
                                 psiModuleManager, cacheManager, 
#else
                                 provider.PsiModuleManager, provider.CacheManager,
#endif
#endif
                                              behavior,
                                              projectEnvoy,
                                              declaringTypeName,
                                              fieldName,
                                              isIgnored);
    }
 public BehaviorFactory(MSpecUnitTestProvider provider, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager, IProject project, ProjectModelElementEnvoy projectEnvoy, ContextCache cache)
 {
   _manager = manager;
   _psiModuleManager = psiModuleManager;
   _cacheManager = cacheManager;