Can anyone provide me with code sample for unit testing a workflow with Rhino Framework. More specificly I cannot seem to stub the CodeActivityContext
object which is a parameter for workflow.execute
method. I am very new to the Rhino and that does not help either.
Testing a Dynamics CRM workflow with Rhino Framework
227 views Asked by imran chowdhury At
1
I recommend a different approach to unit testing, which differs from most blogs and posts.
I recommend getting the IOrganizationService and any data or identifiers that you need in order to execute your function. I then recommend putting the function that does the heavy lifting (logic, CRUD operations, etc.) in a separate class. This way, you only have to create a mock of the IOrganizationService. Here's an example:
And here's an example of how to get what you need out of the CodeActivityContext: