Example #1
0
 protected virtual void PresentContext(ContextElement element,
                                       IPresentableItem item,
                                       TreeModelNode modelNode,
                                       PresentationState state)
 {
   PresentItem(item, element, state, UnitTestElementImage.TestContainer);
 }
		public UnitTestTask CreateContextTask(ContextElement context, bool isExplicit)
		{
			return new UnitTestTask(context,
									new ContextTask(_providerId,
													context.AssemblyLocation,
													context.GetTypeClrName(),
													false));
		}
    public ContextSpecificationElement(IUnitTestProvider provider,
                                       // ReSharper disable SuggestBaseTypeForParameter
                                       ContextElement context,
                                       // ReSharper restore SuggestBaseTypeForParameter
										ProjectModelElementEnvoy project,
                                       string declaringTypeName,
                                       string fieldName,
                                       bool isIgnored)
      : base(provider, context, project, declaringTypeName, fieldName, isIgnored || context.IsExplicit)
    {
    }
    public ContextSpecificationElement CreateContextSpecification(ContextElement context, IMetadataField specification)
    {
      return GetOrCreateContextSpecification(_provider,
#if RESHARPER_61
                                             _manager, _psiModuleManager, _cacheManager, 
#endif
                                             _project,
                                             context,
                                             _projectEnvoy,
                                             specification.DeclaringType.FullyQualifiedName,
                                             specification.Name);
    }
		public UnitTestTask CreateAssemblyLoadTask(ContextElement context)
		{
			return new UnitTestTask(null,
									new AssemblyLoadTask(context.AssemblyLocation));
		}
    public static ContextSpecificationElement GetOrCreateContextSpecification(TestProvider provider,
#if RESHARPER_61
                                                                              IUnitTestElementManager manager,
                                                                              PsiModuleManager psiModuleManager,
                                                                              CacheManager cacheManager,
#endif
                                                                              IProject project,
                                                                              ContextElement context,
                                                                              ProjectModelElementEnvoy projectEnvoy,
                                                                              string declaringTypeName,
                                                                              string fieldName)
    {
#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, false);
    }
 public static string CreateId(ContextElement parent, string fieldName)
 {
   var id = String.Format("{0}.{1}", parent.Id, fieldName);
   System.Diagnostics.Debug.WriteLine("CSE " + id);
   return id;
 }