public RunViaUnityEditorStrategy(ISolution solution,
                                         IUnitTestResultManager unitTestResultManager,
                                         UnityEditorProtocol editorProtocol,
                                         NUnitTestProvider unitTestProvider,
                                         IUnitTestElementIdFactory idFactory,
                                         ISolutionSaver riderSolutionSaver,
                                         UnityRefresher unityRefresher,
                                         NotificationsModel notificationsModel,
                                         UnityHost unityHost,
                                         ILogger logger,
                                         Lifetime lifetime,
                                         PackageValidator packageValidator
                                         )
        {
            mySolution = solution;
            myUnitTestResultManager = unitTestResultManager;
            myEditorProtocol        = editorProtocol;
            myUnitTestProvider      = unitTestProvider;
            myIDFactory             = idFactory;
            myRiderSolutionSaver    = riderSolutionSaver;
            myUnityRefresher        = unityRefresher;
            myNotificationsModel    = notificationsModel;
            myUnityHost             = unityHost;
            myLogger           = logger;
            myLifetime         = lifetime;
            myPackageValidator = packageValidator;
            myElements         = new WeakToWeakDictionary <UnitTestElementId, IUnitTestElement>();

            myUnityProcessId = new Property <int?>(lifetime, "RunViaUnityEditorStrategy.UnityProcessId");

            myUnityProcessId.ForEachValue_NotNull(lifetime, (lt, processId) =>
            {
                var process = myLogger.CatchIgnore(() => Process.GetProcessById(processId.NotNull()));
                if (process == null)
                {
                    myUnityProcessId.Value = null;
                    return;
                }

                process.EnableRaisingEvents = true;

                void OnProcessExited(object sender, EventArgs a) => myUnityProcessId.Value = null;
                lt.Bracket(() => process.Exited += OnProcessExited, () => process.Exited -= OnProcessExited);

                if (process.HasExited)
                {
                    myUnityProcessId.Value = null;
                }
            });

            myEditorProtocol.UnityModel.ViewNotNull(lifetime, (lt, model) =>
            {
                if (model.UnityProcessId.HasValue())
                {
                    myUnityProcessId.Value = model.UnityProcessId.Value;
                }

                model.UnityProcessId.FlowInto(lt, myUnityProcessId, id => id);
            });
        }
Exemplo n.º 2
0
        public UnityNUnitServiceProvider(ISolution solution,
                                         IPsiModules psiModules,
                                         ISymbolCache symbolCache,
                                         IUnitTestElementIdFactory idFactory,
                                         IUnitTestElementManager elementManager,
                                         NUnitTestProvider provider,
                                         IUnitTestingSettings settings,
                                         ISettingsStore settingsStore,
                                         ISettingsOptimization settingsOptimization,
                                         ISettingsCache settingsCache,
                                         UnitTestingCachingService cachingService,
                                         INUnitTestParametersProvider testParametersProvider,
                                         UnityEditorProtocol editorProtocol,
                                         RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                         UnitySolutionTracker unitySolutionTracker)
            : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settings, settingsStore,
                   settingsOptimization, settingsCache, cachingService, testParametersProvider)
        {
            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myRdUnityModel         = solution.GetProtocolSolution().GetRdUnityModel();
            myEditorProtocol       = editorProtocol;
            myUnityEditorStrategy  = runViaUnityEditorStrategy;
            myUnitySolutionTracker = unitySolutionTracker;
        }
Exemplo n.º 3
0
        public UnityNUnitServiceProvider(ISolution solution,
                                         IPsiModules psiModules,
                                         ISymbolCache symbolCache,
                                         IUnitTestElementIdFactory idFactory,
                                         IUnitTestElementManager elementManager,
                                         NUnitTestProvider provider,
                                         IUnitTestingSettings settings,
                                         ISettingsStore settingsStore,
                                         ISettingsOptimization settingsOptimization,
                                         ISettingsCache settingsCache,
                                         UnitTestingCachingService cachingService,
                                         INUnitTestParametersProvider testParametersProvider,
                                         FrontendBackendHost frontendBackendHost,
                                         BackendUnityHost backendUnityHost,
                                         RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                         UnitySolutionTracker unitySolutionTracker)
            : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settings, settingsStore,
                   settingsOptimization, settingsCache, cachingService, testParametersProvider)
        {
            // Only in tests
            if (!frontendBackendHost.IsAvailable)
            {
                return;
            }

            myFrontendBackendModel = frontendBackendHost.Model.NotNull("frontendBackendHost.Model != null");
            myBackendUnityHost     = backendUnityHost;
            myUnityEditorStrategy  = runViaUnityEditorStrategy;
            myUnitySolutionTracker = unitySolutionTracker;
        }
        public RunViaUnityEditorStrategy(ISolution solution,
                                         IUnitTestResultManager unitTestResultManager,
                                         BackendUnityHost backendUnityHost,
                                         NUnitTestProvider unitTestProvider,
                                         IUnitTestElementIdFactory idFactory,
                                         ISolutionSaver riderSolutionSaver,
                                         UnityRefresher unityRefresher,
                                         NotificationsModel notificationsModel,
                                         FrontendBackendHost frontendBackendHost,
                                         ILogger logger,
                                         Lifetime lifetime,
                                         PackageValidator packageValidator,
                                         JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics)
        {
            mySolution = solution;
            myUnitTestResultManager = unitTestResultManager;
            myBackendUnityHost      = backendUnityHost;
            myUnitTestProvider      = unitTestProvider;
            myIDFactory             = idFactory;
            myRiderSolutionSaver    = riderSolutionSaver;
            myUnityRefresher        = unityRefresher;
            myNotificationsModel    = notificationsModel;
            myFrontendBackendHost   = frontendBackendHost;
            myLogger           = logger;
            myLifetime         = lifetime;
            myPackageValidator = packageValidator;
            myUsageStatistics  = usageStatistics;

            myUnityProcessId = new Property <int?>(lifetime, "RunViaUnityEditorStrategy.UnityProcessId");

            myUnityProcessId.ForEachValue_NotNull(lifetime, (lt, processId) =>
            {
                var process = myLogger.CatchIgnore(() => Process.GetProcessById(processId.NotNull()));
                if (process == null)
                {
                    myUnityProcessId.Value = null;
                    return;
                }

                process.EnableRaisingEvents = true;

                void OnProcessExited(object sender, EventArgs a) => myUnityProcessId.Value = null;
                lt.Bracket(() => process.Exited += OnProcessExited, () => process.Exited -= OnProcessExited);

                if (process.HasExited)
                {
                    myUnityProcessId.Value = null;
                }
            });

            myBackendUnityHost.BackendUnityModel.ViewNotNull(lifetime, (lt, model) =>
            {
                // This will set the current value, if it exists
                model.UnityApplicationData.FlowInto(lt, myUnityProcessId, data => data.UnityProcessId);
            });
        }
Exemplo n.º 5
0
 public RunViaUnityEditorStrategy(ISolution solution,
                                  IUnitTestResultManager unitTestResultManager,
                                  UnityEditorProtocol unityEditorProtocol,
                                  NUnitTestProvider unitTestProvider,
                                  IUnitTestElementIdFactory idFactory)
 {
     mySolution = solution;
     myUnitTestResultManager = unitTestResultManager;
     myUnityEditorProtocol   = unityEditorProtocol;
     myUnitTestProvider      = unitTestProvider;
     myIDFactory             = idFactory;
     myElements = new WeakToWeakDictionary <UnitTestElementId, IUnitTestElement>();
 }
 public RunViaUnityEditorStrategy(ISolution solution,
                                  IUnitTestResultManager unitTestResultManager,
                                  UnityEditorProtocol editorProtocol,
                                  NUnitTestProvider unitTestProvider,
                                  IUnitTestElementIdFactory idFactory,
                                  ISolutionSaver riderSolutionSaver,
                                  UnityRefresher unityRefresher,
                                  NotificationsModel notificationsModel,
                                  UnityHost unityHost,
                                  ILogger logger
                                  )
 {
     mySolution = solution;
     myUnitTestResultManager = unitTestResultManager;
     myEditorProtocol        = editorProtocol;
     myUnitTestProvider      = unitTestProvider;
     myIDFactory             = idFactory;
     myRiderSolutionSaver    = riderSolutionSaver;
     myUnityRefresher        = unityRefresher;
     myNotificationsModel    = notificationsModel;
     myUnityHost             = unityHost;
     myLogger   = logger;
     myElements = new WeakToWeakDictionary <UnitTestElementId, IUnitTestElement>();
 }
 public UnityNUnitServiceProvider(ISolution solution, IPsiModules psiModules, ISymbolCache symbolCache,
                                  IUnitTestElementIdFactory idFactory, IUnitTestElementManager elementManager, NUnitTestProvider provider,
                                  ISettingsStore settingsStore, ISettingsOptimization settingsOptimization, ISettingsCache settingsCache,
                                  UnitTestingCachingService cachingService, IDotNetCoreSdkResolver dotNetCoreSdkResolver,
                                  UnityEditorProtocol unityEditorProtocol,
                                  RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                  NUnitOutOfProcessUnitTestRunStrategy nUnitOutOfProcessUnitTestRunStrategy)
     : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settingsStore,
            settingsOptimization, settingsCache, cachingService, dotNetCoreSdkResolver, nUnitOutOfProcessUnitTestRunStrategy)
 {
     myUnityEditorProtocol = unityEditorProtocol;
     myUnityEditorStrategy = runViaUnityEditorStrategy;
 }
Exemplo n.º 8
0
        public UnityNUnitServiceProvider(ISolution solution, IPsiModules psiModules, ISymbolCache symbolCache,
                                         IUnitTestElementIdFactory idFactory, IUnitTestElementManager elementManager, NUnitTestProvider provider,
                                         ISettingsStore settingsStore, ISettingsOptimization settingsOptimization, ISettingsCache settingsCache,
                                         UnitTestingCachingService cachingService, IDotNetCoreSdkResolver dotNetCoreSdkResolver,
                                         UnityEditorProtocol editorProtocol,
                                         RunViaUnityEditorStrategy runViaUnityEditorStrategy,
                                         NUnitOutOfProcessUnitTestRunStrategy nUnitOutOfProcessUnitTestRunStrategy)
            : base(solution, psiModules, symbolCache, idFactory, elementManager, provider, settingsStore,
                   settingsOptimization, settingsCache, cachingService, dotNetCoreSdkResolver, nUnitOutOfProcessUnitTestRunStrategy)
        {
            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myRdUnityModel = solution.GetProtocolSolution().GetRdUnityModel();

            myEditorModel         = editorProtocol.UnityModel;
            myUnityEditorStrategy = runViaUnityEditorStrategy;
        }
Exemplo n.º 9
0
 public UnityTestProvider(NUnitTestProvider nUnitTestProvider)
 {
     myNUnitTestProvider = nUnitTestProvider;
 }