Skip to content

Testing Processes from Visual Studio

Overview

When developing a program using the Client API provided with Neuron ESB, users may want to be able to call processes or individual steps from a Neuron configuration. This sample shows users how to call and test entire processes contained within a Neuron configuration and also how to load documents from the configurations Repository.

Running the Sample

Open the Sample

To open this sample, see the topic Using the Neuron Samples and select the Testing Processes from Visual Studio sample.

Note: This sample does not open a Neuron ESB Configuration. It only opens a Visual Studio project. See comments in the code for more information.

Configure the Sample

When launching this sample from the Samples Explorer, a Visual Studio project is opened. This project needs to be built.

Before running this sample, follow these instructions:

  1. In the Visual Studio project that opens, add a reference to Neuron.Esb.dll, Neuron.dll, and Neuron.Pipelines.dll
  2. Build the solution.
  3. In Neuron Explorer, open the MessageValidationTransformation configuration found in the samples configurations folder at C:\Program Files\Neudesic\Neuron ESB v3\Samples\Configurations\MessageValidationTransformation.
  4. Open the “Validate Book Message – Code” Process in Neuron Explorer and disable the “set schema & xslt” Process Step.
  5. Replace the Cancel step with a Rethrow step. Save the ESB Configuration (save it in a different folder using Save As if you want to keep the sample MessageValidationTransformation configuration unchanged).

Run the Sample Program

  1. Start the Visual Studio project by pressing F5.
  2. This project first demonstrates how to call individual process steps. In this sample, the Validate-Schema and Transform-Xslt steps are tested.
  3. This project then demonstrates how to test an entire process that is included in a Neuron Configuration. The process tested performs a dynamic message validation and dynamic transformation. This means that the schema for the validation is selected from the configurations Repository in a code step, and the XSLT used in the transformation is also selected from the Repository in a code step.
Figure 1: After successfully running the sample program
  1. Optionally, this sample will also demonstrate testing the MSMQ process step for both sending and receiving messages. To test these steps, first make sure you have a local transactional private MSMQ queue named unit_test_msmq and that the user running the sample has full access to that queue. Then uncomment the lines in the Main function:
            static void Main(string[] args)
            {
                TestValidateSchemaStep();
                TestTransformXsltStep();
                TestMsmqStepSend();
                TestMsmqStepReceive();
                ExecuteProcess();
                Console.WriteLine("Finished");
                Console.ReadLine();
            }
  2. Run the test again by pressing F5.
Figure 2: After successfully running the program with the MSMQ process steps
Was this article helpful?
Dislike 0
Previous: Transactional Process
Next: Splitting Messages with Null Join