protected virtual void PresentBehavior(BehaviorElement element, IPresentableItem item, TreeModelNode modelNode, PresentationState state) { PresentItem(item, element, state, UnitTestElementImage.TestContainer); }
public static UnitTestElementId CreateId(IUnitTestProvider provider, BehaviorElement behaviorElement, string fieldName) { var result = new[] { behaviorElement.Id, fieldName }; var id = result.Where(s => !string.IsNullOrEmpty(s)).AggregateString("."); return(new UnitTestElementId(provider, new PersistentProjectId(behaviorElement.GetProject()), id)); }
BehaviorSpecificationElement CreateBehaviorSpecification(BehaviorElement behavior, IMetadataField behaviorSpecification) { return this.GetOrCreateBehaviorSpecification(behavior, this._reflectionTypeNameCache.GetClrName(behaviorSpecification.DeclaringType), behaviorSpecification.Name, behaviorSpecification.IsIgnored()); }
internal BehaviorSpecificationElement CreateBehaviorSpecification(BehaviorElement behavior, IDeclaredElement behaviorSpecification) { return this.GetOrCreateBehaviorSpecification(behavior, ((ITypeMember)behaviorSpecification).GetContainingType() .GetClrName() .GetPersistent(), behaviorSpecification.ShortName, behaviorSpecification.IsIgnored()); }
public IEnumerable<BehaviorSpecificationElement> CreateBehaviorSpecificationsFromBehavior( BehaviorElement behavior, IMetadataField behaviorSpecification) { var typeContainingBehaviorSpecifications = behaviorSpecification.GetFirstGenericArgument(); foreach (var specification in typeContainingBehaviorSpecifications.GetSpecifications()) { yield return this.CreateBehaviorSpecification(behavior, specification); } }
public void AddBehavior(IDeclaredElement type, BehaviorElement behavior) { if (!this._behaviors.ContainsKey(type)) { this._behaviors.Add(type, behavior); } else { this._behaviors[type] = behavior; } }
public BehaviorSpecificationElement(MSpecUnitTestProvider provider, UnitTestElementId id, BehaviorElement behavior, IClrTypeName declaringTypeName, UnitTestingCachingService cachingService, IUnitTestElementManager elementManager, string fieldName, bool isIgnored ) : base(provider, behavior, declaringTypeName, cachingService, elementManager, fieldName, isIgnored || behavior.Explicit) { this._id = id; }
public BehaviorSpecificationElement(MSpecUnitTestProvider provider, IPsi psiModuleManager, ICache cacheManager, ProjectModelElementEnvoy projectEnvoy, BehaviorElement behavior, IClrTypeName declaringTypeName, string fieldName, bool isIgnored ) : base(provider, psiModuleManager, cacheManager, behavior, projectEnvoy, declaringTypeName, fieldName, isIgnored || behavior.Explicit) { this._id = CreateId(provider, behavior, fieldName); }
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); }
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); }