IoC for Workflow Unit testing

Feb 14, 2011 at 6:12 PM

Have you considered using Unity or other IoC container for controlling XAML injection?  In my current project, we create workflows using imperative code.  Activities are resolved from the container, which allows for dependencies to be externalized from the code and the test.  I also created a simple extension method for activity creation that allows one to keep close to the object initializer syntax.  For example:

new Sequence
  Activities =
    Container.Resolve<MyActivity>().InitializeArguments(activity =>
      activity.Argument1 = new InArgument<string>(),

The XamlInjector could use the container to do the same thing to XAML based workflows.

Feb 25, 2011 at 7:17 PM

Great idea - I'll have to think about how we can do this.

Mar 29, 2011 at 8:36 PM

I wrote an extension for ninject to enable this. Look at: