Unit Testing Windows Workflow

Due to the nature of how Windows Workflow works, it has proved to be challenging to unit test. It’s not good enough to just instantiate a Workflow Activity and test it’s Execute method. You will need to make use of WorkflowRuntime to start your workflow, and to make matters worse, it runs in a background thread. How do you mock out and isolate these dependencies?

After doing some research I came across a great post from Michael Kennedy who has come up with a unit testing library just for this problem. You can download this library for use, or just to understand and create your own library. Thanks Michael for your contribution, it has certainly given me some great insights.