Windows Server AppFabric / Workflow Services Demo - Contoso HR

This sample demonstrates how you can use a Windows Workflow Foundation (WF4) Workflow Service and Windows Server AppFabric to construct a long running business process.

C# (6.3 MB)
4.9 Star
6,156 times
Add to favorites
E-mail Twitter Digg Facebook

Solution explorer

namespace MathServiceLibrary.Tests
    using System.ServiceModel;

    using Microsoft.Activities.UnitTesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    public class IncrementServiceTest
        #region Constants and Fields

        private static readonly EndpointAddress serviceAddress = new EndpointAddress("net.pipe://localhost/IncrementService");

        private static NetNamedPipeBinding binding = new NetNamedPipeBinding();


        #region Properties

        ///  Gets or sets the test context which provides
        ///  information about and functionality for the current test run.
        public TestContext TestContext { get; set; }


        #region Public Methods

// You must deploy the XAMLX file to the test directory
public void IncrementServiceShouldIncrementData()
    // Arrange
    const int initialData = 1;
    const int expectedData = 2;

    WorkflowServiceTestHost host = null;
        using (host = WorkflowServiceTestHost.Open("IncrementService.xamlx", serviceAddress))
            var proxy = new IncrementService.ServiceClient(binding, serviceAddress);
            int? value = initialData;
            proxy.Increment(ref value);
            Assert.AreEqual(expectedData, value, "Increment did not correctly increment the value");
        if (host != null)