Provides a property that will attach and detach a known event handler delegate when the bit is flipped.
        /// <summary>
        /// Initiate unit test harness.
        /// </summary>
        public UnitTestHarness()
        {
            _events            = new UnitTestHarnessEvents(this);
            State              = new TestHarnessState();
            LogProviders       = new List <LogProvider>();
            _queuedLogMessages = new Queue <LogMessage>();

            _globalExceptions = new GlobalExceptionHandler(GlobalUnhandledExceptionListener);
            _dispatcherStack  = new WorkItemsManager();
            Results           = new List <ScenarioResult>();
            LogWriter         = new UnitTestLogMessageWriter(this);
            LogicFactory      = new UnitTestLogicFactory(this);
        }
 /// <summary>
 /// Listener event for any unhandled exceptions.
 /// </summary>
 /// <param name="sender">Sender object instance.</param>
 /// <param name="e">Event arguments.</param>
 private void GlobalUnhandledExceptionListener(object sender, EventArgs e)
 {
     if (DispatcherStack.CurrentCompositeWorkItem is CompositeWorkItem)
     {
         CompositeWorkItem cd        = (CompositeWorkItem)DispatcherStack.CurrentCompositeWorkItem;
         Exception         exception = GlobalExceptionHandler.GetExceptionObject(e);
         cd.WorkItemException(exception);
         GlobalExceptionHandler.ChangeExceptionBubbling(e, /* handled */ true);
     }
     else
     {
         GlobalExceptionHandler.ChangeExceptionBubbling(e, /* handled */ false);
     }
 }
예제 #3
0
        /// <summary>
        /// Initiate unit test harness.
        /// </summary>
        public UnitTestHarness()
            : base()
        {
            _globalExceptions = new GlobalExceptionHandler(GlobalUnhandledExceptionListener);
            _dispatcherStack = new WorkItemsManager();
            Results = new List<ScenarioResult>();
            LogWriter = new UnitTestLogMessageWriter(this);
            LogicFactory = new UnitTestLogicFactory(this);

            // Attach to publishing event
            Publishing += (sender, args) => ReportCodeCoverage(TestService);

            // Create the initial dispatcher tasks
            CreateHarnessTasks();
        }
        /// <summary>
        /// Initiate unit test harness.
        /// </summary>
        public UnitTestHarness()
        {
            _events = new UnitTestHarnessEvents(this);
            State = new TestHarnessState();
            LogProviders = new List<LogProvider>();
            _queuedLogMessages = new Queue<LogMessage>();

            _globalExceptions = new GlobalExceptionHandler(GlobalUnhandledExceptionListener);
            _dispatcherStack = new WorkItemsManager();
            Results = new List<ScenarioResult>();
            LogWriter = new UnitTestLogMessageWriter(this);
            LogicFactory = new UnitTestLogicFactory(this);
        }