Exemple #1
0
 private void OnTestLoaded(TestEventArgs ea)
 {
     _view.Initialize("Ready", ea.Test.TestCount);
 }
        private void WireUpEvents()
        {
            _model.Events.TestLoaded += (ea) =>
            {
                ClearCounters();

                _view.Initialize(ea.Test.TestCount);
                _view.DisplayText(ea.Test.TestCount > 0 ? "Ready" : "");
            };

            _model.Events.TestReloaded += (ea) =>
            {
                ClearCounters();

                _view.Initialize(ea.Test.TestCount);
                _view.DisplayText("Reloaded");
            };

            _model.Events.TestUnloaded += (ea) =>
            {
                ClearCounters();

                _view.Initialize(0);
                _view.DisplayText("Unloaded");
            };

            _model.Events.RunStarting += (ea) =>
            {
                ClearCounters();

                _view.Initialize(ea.TestCount);
                _view.DisplayTestsRun(0);
                _view.DisplayPassed(0);
                _view.DisplayFailed(0);
                _view.DisplayWarnings(0);
                _view.DisplayInconclusive(0);
                _view.DisplayDuration(0.0);
            };

            _model.Events.RunFinished += (ea) =>
            {
                _view.DisplayText("Completed");
                _view.DisplayDuration(ea.Result.Duration);
            };

            _model.Events.TestStarting += (ea) =>
            {
                _view.DisplayText(ea.Test.FullName);
            };

            _model.Events.TestFinished += (ea) =>
            {
                _view.DisplayTestsRun(++_testsRun);

                switch (ea.Result.Outcome.Status)
                {
                case TestStatus.Passed:
                    _view.DisplayPassed(++_passedCount);
                    break;

                case TestStatus.Failed:
                    _view.DisplayFailed(++_failedCount);
                    break;

                case TestStatus.Warning:
                    _view.DisplayWarnings(++_warningCount);
                    break;

                case TestStatus.Inconclusive:
                    _view.DisplayInconclusive(++_inconclusiveCount);
                    break;
                }
            };
        }