コード例 #1
0
        public UnitTestAnimations(Lifetime lifetime, IUnitTestSessionConductor sessionConductor,
                                  IUnitTestResultManager resultsManager, Agent agent, IThreading threading)
        {
            this.resultsManager = resultsManager;
            this.agent          = agent;
            this.threading      = threading;
            var testSessionLifetimes = new Dictionary <IUnitTestSessionTreeViewModel, LifetimeDefinition>();

            sessionConductor.SessionOpened.Advise(lifetime, sessionView =>
            {
                var sessionLifetimeDefinition = Lifetimes.Define(lifetime, "Clippy::TestSession");
                testSessionLifetimes.Add(sessionView, sessionLifetimeDefinition);

                SubscribeToSessionLaunch(sessionLifetimeDefinition.Lifetime, sessionView.Session);
            });

            sessionConductor.SessionClosed.Advise(lifetime, sessionView =>
            {
                LifetimeDefinition sessionLifetimeDefinition;
                if (testSessionLifetimes.TryGetValue(sessionView, out sessionLifetimeDefinition))
                {
                    sessionLifetimeDefinition.Terminate();
                    testSessionLifetimes.Remove(sessionView);
                }
            });
        }
コード例 #2
0
        public TestRunEventGenerator(Lifetime lifetime,
                                     IUnitTestSessionConductor sessionManager,
                                     IUnitTestResultManager resultManager,
                                     IThreading threading,
                                     IRSEnv env,
                                     IMessageBus messageBus,
                                     IDateUtils dateUtils)
            : base(env, messageBus, dateUtils, threading)
        {
            _resultManager = resultManager;
            _threading     = threading;

            var testSessionLifetimes = new Dictionary <IUnitTestSessionTreeViewModelBase, LifetimeDefinition>();

            sessionManager.SessionOpened.Advise(
                lifetime,
                sessionView =>
            {
                var sessionLifetimeDefinition =
                    Lifetimes.Define(lifetime, "KaVE::TestRunEventGenerator");
                testSessionLifetimes.Add(sessionView, sessionLifetimeDefinition);

                SubscribeToSessionLaunch(sessionLifetimeDefinition.Lifetime, sessionView.Session);
            });

            sessionManager.SessionClosed.Advise(
                lifetime,
                sessionView =>
            {
                LifetimeDefinition sessionLifetimeDefinition;
                if (testSessionLifetimes.TryGetValue(sessionView, out sessionLifetimeDefinition))
                {
                    sessionLifetimeDefinition.Terminate();
                    testSessionLifetimes.Remove(sessionView);
                }
            });
        }