c# 4.0 - Workflow Foundation - Literal only supports value types and the immutable type System.String -
i have following unit test wf code activity called mycodeactivity:
[expectedexception(typeof(argumentexception))] [testmethod] public void shouldrequireparam() { //arrange var invoker = new workflowinvoker(new mycodeactivity() { myint = 2, mycomplexobject = _complexobject }); //act invoker.invoke(); //assert assert.fail("expected argumentexception"); }
when run test following exception
'literal< mycomplexobject>': literal supports value types , immutable type system.string. type mycomplexobject cannot used literal.
to fix immediate problem:
mycomplexobject = _complexobject
to
mycomplexobject = new inargument<mycomplexobject>((ctx) => _complexobject)
further reading : http://msdn.microsoft.com/en-us/library/ee358749.aspx .
note: should use microsoft.activities.unittesting package available on nuget. makes ioc alot easier (seeing wf works service locator pattern , not dependency injection)
Comments
Post a Comment