예제 #1
0
        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), typeName, methodName, EmptyArray <string> .Instance, isIgnored));
        }
        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,
                                                   ISolution solution,
                                                   ContextSpecificationFactory factory)
        {
            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(factory.GetOrCreateContextSpecification(context,
                                                           new ClrTypeName(typeName),
                                                           methodName,
                                                           isIgnored));
        }
예제 #4
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)
            };
        }
예제 #5
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 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;
 }
예제 #7
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);
            }
        }
 public ContextSpecificationElementHandler(ElementFactories factories)
 {
     this._factory = factories.ContextSpecifications;
 }
예제 #10
0
 public ContextSpecificationElementHandler(ContextSpecificationFactory contextSpecificationFactory)
 {
     _contextSpecificationFactory = contextSpecificationFactory;
 }