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 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); }