Exemplo n.º 1
0
        public void OnTerminatedTest()
        {
            PrivateObject param0 = new PrivateObject(CreateProcess());
            Process_Accessor target = new Process_Accessor(param0);
            ProcessExitEventArgs eventArgs = new ProcessExitEventArgs {CompletionState = new {Field = 123}};

            bool terminatedEventCalled = false;

            target.add_Terminated((s, e)=>
                                      {
                                          terminatedEventCalled = true;
                                          Assert.AreEqual<ProcessExecutionState>(ProcessExecutionState.Terminated, target.ExecutionState);
                                      });

            target.OnTerminated(eventArgs);

            Assert.IsTrue(terminatedEventCalled);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Provides default implementation of the Completed pre-handler
 /// </summary>
 /// <param name="eventArgs"></param>
 protected virtual void OnTerminated(ProcessExitEventArgs eventArgs)
 {
     SetExecutionState(ProcessExecutionState.Terminated);
     // first notify handlers
     if (Terminated != null)
         Terminated(this, eventArgs);
     // signal waiters
     CompletedEvent.Set();
 }
Exemplo n.º 3
0
        public void OnCompletedTest()
        {
            var target = CreateProcess_Accessor();
            var eventArgs = new ProcessExitEventArgs {CompletionState = new {Field = 123}};

            bool completedEventCalled = false;

            target.add_Completed((s, e) =>
            {
                completedEventCalled = true;
                Assert.AreEqual<ProcessExecutionState>(ProcessExecutionState.Completed, target.ExecutionState);
            });

            target.OnCompleted(eventArgs);

            Assert.IsTrue(completedEventCalled);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Provides default implementation of the Completed pre-handler
        /// </summary>
        /// <param name="eventArgs"></param>
        protected virtual void OnCompleted(ProcessExitEventArgs eventArgs)
        {
            SetExecutionState(ProcessExecutionState.Completed);
            if (Completed != null)
                Completed(this, eventArgs);

            CompletedEvent.Set();
        }