Example #1
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));
        }
        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, 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));
        }
Example #3
0
        public BehaviorSpecificationElement GetOrCreateBehaviorSpecification(BehaviorElement behavior,
                                                                             IClrTypeName declaringTypeName,
                                                                             string fieldName,
                                                                             bool isIgnored)
        {
            var id = BehaviorSpecificationElement.CreateId(_provider, behavior, fieldName);
            var behaviorSpecification = this._manager.GetElementById(id) as BehaviorSpecificationElement;

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

            return(new BehaviorSpecificationElement(this._provider,
                                                    this._psiModuleManager,
                                                    this._cacheManager,
                                                    new ProjectModelElementEnvoy(behavior.GetProject()),
                                                    behavior,
                                                    declaringTypeName,
                                                    fieldName,
                                                    isIgnored));
        }
        public BehaviorSpecificationElement GetOrCreateBehaviorSpecification(BehaviorElement behavior,
                                                                             IClrTypeName declaringTypeName,
                                                                             string fieldName,
                                                                             bool isIgnored)
        {
            var id = BehaviorSpecificationElement.CreateId(_elementIdFactory, _provider, behavior, fieldName);

            var behaviorSpecification = this._manager.GetElementById(id) as BehaviorSpecificationElement;

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

            return(new BehaviorSpecificationElement(this._provider,
                                                    id,
                                                    behavior,
                                                    declaringTypeName.GetPersistent(),
                                                    this._cachingService,
                                                    this._manager,
                                                    fieldName,
                                                    isIgnored));
        }