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!