Workflow Foundation - Literal only supports value types and the immutable type System.String

后端 未结 1 1466
忘了有多久
忘了有多久 2021-01-18 07:31

I have the following unit test for a WF code activity called MyCodeActivity:

[ExpectedException(typeof(ArgumentException))]
[TestMethod]
public void ShouldRe         


        
相关标签:
1条回答
  • 2021-01-18 07:40

    To fix the immediate problem:

    MyComplexObject = _complexObject
    

    to

    MyComplexObject = new InArgument<MyComplexObject>((ctx) => _complexObject)
    

    Further reading : http://msdn.microsoft.com/en-us/library/ee358749.aspx .

    Note: You should also use the Microsoft.Activities.UnitTesting package available on NuGet. It makes IOC alot easier (seeing as WF works with the Service Locator pattern and not Dependency Injection)

    0 讨论(0)
提交回复
热议问题