using System; using Pegasus.Workflow.Service; namespace Pegasus.UnitTests.Workflow.Service.Workflows { /// <summary> /// Testing data exchange service /// </summary> public class TestDataExchangeService : WorkflowDataExchangeService { // Local Instance Values private bool m_startCalled = false; private bool m_stopCalled = false; /// <summary> /// Gets a value indicating whether start method was called. /// </summary> /// <value><c>true</c> if called; otherwise, <c>false</c>.</value> public bool StartCalled { get { return m_startCalled; } } /// <summary> /// Gets a value indicating whether the stop method was called. /// </summary> /// <value><c>true</c> if called; otherwise, <c>false</c>.</value> public bool StopCalled { get { return m_stopCalled; } } /// <summary> /// Starts this instance of the service. /// </summary> /// <param name="workflowService"></param> public override void Start( WorkflowService workflowService ) { base.Start( workflowService ); m_startCalled = true; } /// <summary> /// Stops this instance of the service. /// </summary> public override void Stop() { base.Stop(); m_stopCalled = true; } /// <summary> /// Fires the first event. /// </summary> /// <param name="args">The <see cref="T:Pegasus.UnitTests.Workflow.Service2.Workflows.TestingEventArgs"/> instance containing the event data.</param> public void FireFirstEvent( TestingEventArgs args ) { if( FirstEvent != null ) { FirstEvent( this, args ); } } /// <summary> /// Fires the second event. /// </summary> /// <param name="args">The <see cref="T:Pegasus.UnitTests.Workflow.Service2.Workflows.TestingEventArgs"/> instance containing the event data.</param> public void FireSecondEvent( TestingEventArgs args ) { if( SecondEvent != null ) { SecondEvent( this, args ); } } /// <summary> /// Fires the third event. /// </summary> /// <param name="args">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> public void FireThirdEvent( EventArgs args ) { if( ThirdEvent != null ) { ThirdEvent( this, args ); } } /// <summary> /// Custom delegate handler to make sure we can tie up customer delegates. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public delegate void CustomerDelegateHandler( object sender, TestingEventArgs args ); /// <summary> /// Event using a generic event handler /// </summary> public event EventHandler<TestingEventArgs> FirstEvent; /// <summary> /// Event using a custom event handler /// </summary> public event CustomerDelegateHandler SecondEvent; /// <summary> /// Event that uses standard event handler (for unable to bind test) /// </summary> public event EventHandler ThirdEvent; } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)