chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I am currently working with Workflow Foundation. More specifically Workflows for SharePoint.

I am trying to mock workflow activities:
Microsoft.SharePoint.WorkflowActions.OnWorkflowActivated which derives from System.Workflow.Activities.HandleExternalEventActivity

Is there a way to simply "bypass" the creation of the base and simply "instanciate" the class, and simulate the "OnInvoked" method ? The designer sets some properties. (Some are Complex "SetBindings" for example, which has ties to the "Component Model")

Any dfferent ideas on how to go about this is welcome.
asked by bobbyangers (2.1k points)

1 Answer

0 votes

In order to bypass the creation of an object you can use the MockObject API. a mockobject is used when you need to create (and pass) an instance of a given type which cant be simply created (interfaces,sealed class, class with hidden ctors).

after you have the "instance", you can now fake all sorts of behaviors on it.

Note that you can click the link to learn more on using sharepoint with Typemock Isolator, or to learn how to unit test a SharePoint application.
answered by lior (13.2k points)