Exemplo n.º 1
0
        private static void OnModelInitializationHandler(UnityModelAndLifetime modelAndLifetime)
        {
            ourLogger.Verbose("AdviseUnitTestLaunch");
            var modelValue         = modelAndLifetime.Model;
            var connectionLifetime = modelAndLifetime.Lifetime;

            modelValue.GetCompilationResult.Set(_ => !EditorUtility.scriptCompilationFailed);

            modelValue.UnitTestLaunch.Advise(connectionLifetime, launch =>
            {
                var collector = TestEventsCollector.Instance;
                ourLogger.Verbose("TestEventsCollectorInstance: " + collector.GetInstanceID() + " DelayedEvents.Count:" + collector.DelayedEvents.Count);
                new TestEventsSender(collector, launch);
            });

            modelValue.RunUnitTestLaunch.Advise(connectionLifetime, () =>
            {
                if (!modelValue.UnitTestLaunch.HasValue())
                {
                    return;
                }

                var testLauncher = new UnityEditorTestLauncher(modelValue.UnitTestLaunch.Value);
                testLauncher.TryLaunchUnitTests();
            });
        }
Exemplo n.º 2
0
        public static void AdviseUnitTestLaunch(UnityModelAndLifetime modelAndLifetime)
        {
            ourLogger.Verbose("AdviseUnitTestLaunch");
            var modelValue         = modelAndLifetime.Model;
            var connectionLifetime = modelAndLifetime.Lifetime;

            modelValue.UnitTestLaunch.Change.Advise(connectionLifetime, launch =>
            {
                var unityEditorTestLauncher = new UnityEditorTestLauncher(launch);
                unityEditorTestLauncher.TryLaunchUnitTests();
            });
        }