예제 #1
0
 public UnityTestsExploration(UnitTestAttributeCache unitTestAttributeCache, IProject project,
                              IUnitTestElementsObserver observer, IUnitTestElementIdFactory unitTestElementIdFactory,
                              UnityTestProvider unityTestProvider, IUnitTestElementManager unitTestElementManager, UnityNUnitServiceProvider serviceProvider)
 {
     myUnitTestAttributeCache = unitTestAttributeCache;
     myProject           = project;
     myUnitTestCollector = observer;
     myElementFactory    = new UnityTestElementFactory(unitTestElementIdFactory, unityTestProvider, unitTestElementManager, serviceProvider);
 }
 public UnityTestFileExplorer(IFile file, UnityTestElementFactory factory, UnitTestAttributeCache unitTestAttributeCache,
                              IUnitTestElementsObserver observer, Func <bool> interrupted, IProject project)
 {
     myFile    = file;
     myFactory = factory;
     myUnitTestAttributeCache = unitTestAttributeCache;
     myObserver          = observer;
     myInterrupted       = interrupted;
     myProject           = project;
     myTargetFrameworkId = myProject.GetCurrentTargetFrameworkId();
 }
 public UnityTestsSourceExplorer([NotNull] ISolution solution, [NotNull] UnityTestProvider provider, ClrLanguagesKnown clrLanguagesKnown,
                                 [NotNull] AssemblyToAssemblyReferencesResolveManager resolveManager, IUnitTestElementIdFactory idFactory,
                                 [NotNull] ResolveContextManager resolveContextManager, [NotNull] ILogger logger,
                                 UnitTestAttributeCache unitTestAttributeCache, IUnitTestElementIdFactory unitTestElementIdFactory, IUnitTestElementManager unitTestElementManager, UnityNUnitServiceProvider serviceProvider)
     : base(solution, provider, resolveManager, resolveContextManager, logger)
 {
     myClrLanguagesKnown        = clrLanguagesKnown;
     myIdFactory                = idFactory;
     myLogger                   = logger;
     myUnitTestAttributeCache   = unitTestAttributeCache;
     myUnitTestElementIdFactory = unitTestElementIdFactory;
     myUnityTestProvider        = provider;
     myUnitTestElementManager   = unitTestElementManager;
     myServiceProvider          = serviceProvider;
 }
        private static bool IsTestMethod(ITypeMember element, UnitTestAttributeCache attributeChecker, IProject project)
        {
            var method = element as IMethod;

            if (method == null)
            {
                return(false);
            }

            if (method.IsAbstract || method.GetAccessRights() != AccessRights.PUBLIC)
            {
                return(false);
            }

            return(attributeChecker.HasAttributeOrDerivedAttribute(project, method,
                                                                   UnityTestProvider.UnityTestAttribute));
        }