public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement) { var typeName = parent.GetAttribute("elementType"); if (Equals(typeName, "ContextElement")) { return(ContextElement.ReadFromXml(parent, _solution, _contextFactory)); } if (Equals(typeName, "BehaviorElement")) { return(BehaviorElement.ReadFromXml(parent, parentElement, _solution, _behaviorFactory)); } if (Equals(typeName, "BehaviorSpecificationElement")) { return(BehaviorSpecificationElement.ReadFromXml(parent, parentElement, _solution, _behaviorSpecificationFactory)); } if (Equals(typeName, "ContextSpecificationElement")) { return(ContextSpecificationElement.ReadFromXml(parent, parentElement, _solution, _contextSpecificationFactory)); } return(null); }
public static ContextSpecificationElement GetOrCreateContextSpecification(MSpecUnitTestProvider provider, IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager, IProject project, ContextElement context, ProjectModelElementEnvoy projectEnvoy, IClrTypeName declaringTypeName, string fieldName, bool isIgnored) { var id = ContextSpecificationElement.CreateId(context, fieldName); var contextSpecification = manager.GetElementById(project, id) as ContextSpecificationElement; if (contextSpecification != null) { contextSpecification.Parent = context; contextSpecification.State = UnitTestElementState.Valid; return(contextSpecification); } return(new ContextSpecificationElement(provider, psiModuleManager, cacheManager, context, projectEnvoy, declaringTypeName, fieldName, isIgnored)); }
public UnitTestTask CreateContextSpecificationTask(ContextElement context, ContextSpecificationElement contextSpecification) { return(new UnitTestTask(contextSpecification, new ContextSpecificationTask(_providerId, context.AssemblyLocation, context.GetTypeClrName().FullName, contextSpecification.FieldName))); }
public void ContextSpecPresentationIsValid() { With(() => { var id = CreateId("id"); var element = new ContextSpecificationElement(id, CreateUnitTestElement(), Substitute.For <IClrTypeName>(), ServiceProvider, "field_is_something", false); Assert.That(element.GetPresentation(null, false), Is.EqualTo("field is something")); }); }
public void CanGetHashCode() { With(() => { var id = CreateId("id"); var element = new ContextSpecificationElement(id, CreateUnitTestElement(), Substitute.For <IClrTypeName>(), ServiceProvider, "field", false); Assert.That(element.GetHashCode(), Is.Not.EqualTo(0)); }); }
public void ContextSpecsWithSamePropertiesAreEqual() { With(() => { var id = CreateId("id"); var type = Substitute.For <IClrTypeName>(); var element1 = new ContextSpecificationElement(id, CreateUnitTestElement(), type, ServiceProvider, "field", false); var element2 = new ContextSpecificationElement(id, CreateUnitTestElement(), type, ServiceProvider, "field", false); Assert.That(element1, Is.EqualTo(element2)); }); }
public IUnitTestElement DeserializeElement(XmlElement parent, IUnitTestElement parentElement) { var typeName = parent.GetAttribute("elementType"); if (Equals(typeName, "ContextElement")) { return(ContextElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager)); } if (Equals(typeName, "BehaviorElement")) { return(BehaviorElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager)); } if (Equals(typeName, "BehaviorSpecificationElement")) { return(BehaviorSpecificationElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager)); } if (Equals(typeName, "ContextSpecificationElement")) { return(ContextSpecificationElement.ReadFromXml(parent, parentElement, _provider, _solution, _manager, _psiModuleManager, _cacheManager)); } return(null); }
public static ContextSpecificationElement GetOrCreateContextSpecification(MSpecUnitTestProvider provider, #if RESHARPER_61 IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager, #endif IProject project, ContextElement context, ProjectModelElementEnvoy projectEnvoy, string declaringTypeName, string fieldName, ICollection <string> tags, bool isIgnored) { #if RESHARPER_6 var id = ContextSpecificationElement.CreateId(context, fieldName); #if RESHARPER_61 var contextSpecification = manager.GetElementById(project, id) as ContextSpecificationElement; #else var contextSpecification = provider.UnitTestManager.GetElementById(project, id) as ContextSpecificationElement; #endif if (contextSpecification != null) { contextSpecification.Parent = context; contextSpecification.State = UnitTestElementState.Valid; return(contextSpecification); } #endif return(new ContextSpecificationElement(provider, #if RESHARPER_6 #if RESHARPER_61 psiModuleManager, cacheManager, #else provider.PsiModuleManager, provider.CacheManager, #endif #endif context, projectEnvoy, declaringTypeName, fieldName, tags, isIgnored)); }
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(_elementIdFactory, _provider, context, fieldName); var contextSpecification = this._manager.GetElementById(id) as ContextSpecificationElement; if (contextSpecification != null) { contextSpecification.Parent = context; return(contextSpecification); } return(new ContextSpecificationElement(this._provider, id, context, declaringTypeName.GetPersistent(), this._cachingService, this._manager, fieldName, isIgnored)); }