I am preparing a typemock test case for an internal class. However when trying to verify a private method of this internal class, I am getting the following exception.
TypeMock Verification: Method Components.Workspace.Impersonation.ImpWorkspaceProvider_Accessor.CreatePermissions(Microsoft.SharePoint.SPWeb, Microsoft.SharePoint.SPWeb) was expected but was not called.
The method is actually getting called and executed.
Following is the code.
public void TestInitialize()
_classUnderTest = Isolate.Fake.Instance<ImpWorkspaceProvider_Accessor>(Members.CallOriginal);
public void AddSiteTest()
_classUnderTest.ReturnItem = fakeItem;
Isolate.Verify.NonPublic.WasCalled (_classUnderTest, "CreatePermissions"); //fails
Isolate.Verify.WasCalledWithAnyArguments(() => _classUnderTest.CreatePermissions(null, null));//fails
Isolate.Verify.WasCalledWithExactArguments(() =>HiddenList.GetSiteNameFromTitle(_cwsTitle)); //passes
The AddSite method inturn calls the CreatePermissions private method.
How can I verify this method call successfully? I am able to verify static method calls within the same method succesfully.