public static UnitTestElementId CreateId(IUnitTestElementIdFactory elementIdFactory, IUnitTestProvider provider, BehaviorElement behaviorElement, string fieldName) { var result = new[] { behaviorElement.Id, fieldName }; var id = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString("."); return(elementIdFactory.Create(provider, behaviorElement.GetProject(), id)); }
public static UnitTestElementId CreateId(IUnitTestElementIdFactory elementIdFactory, IUnitTestProvider provider, BehaviorElement behaviorElement, string fieldName) { var result = new[] { behaviorElement.Id, fieldName }; var id = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString("."); return elementIdFactory.Create(provider, new PersistentProjectId(behaviorElement.GetProject()), id); }
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; behaviorSpecification.State = UnitTestElementState.Valid; return behaviorSpecification; } return new BehaviorSpecificationElement(this._provider, this._psiModuleManager, this._cacheManager, id, new ProjectModelElementEnvoy(behavior.GetProject()), behavior, declaringTypeName, fieldName, isIgnored); }