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
0 votes
I'm trying to tests the creation of a SPWorkflowAssociation object, but for some unknown reason TypeMock (using AAA) keeps telling me that there was an unexpected call to the method I was expecting a call to.

Exception Message:
Test method BizColostateFeatureReceiverToolsTest.ListToolKitTest.AssociateWorkflowWithlistTestNewWorkflow threw exception: TypeMock.VerifyException:
TypeMock Verification: Unexpected Call to Microsoft.SharePoint.SPList.AddWorkflowAssociation().

The Calling code looks like this:
association = AssociateWorkflow(workflowTemplate, associatedWorkflowName, taskList, historyList, allowManual, autoStartCreate, autoStartChange, associationData);

association = targetList.AddWorkflowAssociation(association); // This is the line the TypeMock exception is being thrown on.

And the relevant test code looks like this:
// set up fake workflow template
Isolate.WhenCalled(() => SPWorkflowAssociation.CreateListAssociation(fakeWorkflowTemplate, associatedWorkflowName,fakeTaskList, fakeHistoryList)).WillReturn(fakeWorkflowAssociation);

Isolate.WhenCalled(() => fakeTargetList.AddWorkflowAssociation(fakeWorkflowAssociation)).WillReturn(fakeWorkflowAssociation);

Any thoughts would be appreciated!
asked by sean.mcdermid@colost (720 points)

1 Answer

0 votes
Hi Sean,

Unfortunately I couldn't run the code you've posted - can you write a full example of the problem you're having?
answered by dhelper (11.9k points)