public BehaviorElement GetOrCreateBehavior(ContextElement context,
                                                   IClrTypeName declaringTypeName,
                                                   string fieldName,
                                                   bool isIgnored,
                                                   string fieldType)
        {
            var id       = BehaviorElement.CreateId(context, fieldType, fieldName);
            var behavior = _manager.GetElementById(context.GetProject(), id) as BehaviorElement;

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

            return(new BehaviorElement(_provider,
                                       _psiModuleManager,
                                       _cacheManager,
                                       context,
                                       new ProjectModelElementEnvoy(context.GetProject()),
                                       declaringTypeName,
                                       fieldName,
                                       isIgnored,
                                       fieldType));
        }
Exemplo n.º 2
0
        public ContextSpecificationElement GetOrCreateContextSpecification(ContextElement context,
                                                                           IClrTypeName declaringTypeName,
                                                                           string fieldName,
                                                                           bool isIgnored)
        {
            var id = ContextSpecificationElement.CreateId(context, fieldName);
            var contextSpecification = _manager.GetElementById(context.GetProject(), id) as ContextSpecificationElement;

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

            return(new ContextSpecificationElement(_provider,
                                                   _psiModuleManager,
                                                   _cacheManager,
                                                   new ProjectModelElementEnvoy(context.GetProject()),
                                                   context,
                                                   declaringTypeName,
                                                   fieldName, isIgnored));
        }
        public ContextSpecificationElement GetOrCreateContextSpecification(ContextElement context,
                                                                           IClrTypeName declaringTypeName,
                                                                           string fieldName,
                                                                           bool isIgnored)
        {
            var id = ContextSpecificationElement.CreateId(_provider, context, fieldName);
            var contextSpecification = this._manager.GetElementById(id) as ContextSpecificationElement;
            if (contextSpecification != null)
            {
                contextSpecification.Parent = context;
                contextSpecification.State = UnitTestElementState.Valid;
                return contextSpecification;
            }

            return new ContextSpecificationElement(this._provider,
                                                   this._psiModuleManager,
                                                   this._cacheManager,
                                                   new ProjectModelElementEnvoy(context.GetProject()),
                                                   context,
                                                   declaringTypeName,
                                                   fieldName, isIgnored);
        }
 public static UnitTestElementId CreateId(IUnitTestElementIdFactory elementIdFactory, IUnitTestProvider provider, ContextElement contextElement, string fieldName)
 {
     var result = new[] { contextElement.Id, fieldName };
     var id = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString(".");
     return elementIdFactory.Create(provider, new PersistentProjectId(contextElement.GetProject()), id);
 }
        public BehaviorElement GetOrCreateBehavior(ContextElement context,
                                                   IClrTypeName declaringTypeName,
                                                   string fieldName,
                                                   bool isIgnored,
                                                   string fieldType)
        {
            var id = BehaviorElement.CreateId(_provider, context, fieldType, fieldName);
            var behavior = this._manager.GetElementById(id) as BehaviorElement;
            if (behavior != null)
            {
                behavior.Parent = context;
                behavior.State = UnitTestElementState.Valid;
                return behavior;
            }

            return new BehaviorElement(this._provider,
                                       this._psiModuleManager,
                                       this._cacheManager,
                                       context,
                                       new ProjectModelElementEnvoy(context.GetProject()),
                                       declaringTypeName,
                                       fieldName,
                                       isIgnored,
                                       fieldType);
        }