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 using reflective typemock to mock a method call as follows:

spaceCommunityBrokerMocked.ExpectAndReturn("Select", spaceCommunityMocked.Object).When(webTitle);


webTitle is a string variable and I am passing that to the mocked object of SPWeb.(setting expectations).

The actual code for this method call is

SpaceCommunity community = objectCommunityBroker.Select(listWeb.Title);


I have mocked all the other objects which are present in the method. But I am getting a Typemock.VerifyException specifying SpaceCommunity.Select has one more expected calls. Would anyone please help?
asked by adam (600 points)

1 Answer

0 votes
Hi,

The error that you are getting means that the expectation that you set for the Select method has not been met. This can happen in several scenarios and its kind of difficult to locate the exact problem from what you posted here.

If you can try removing the "When" statement and see what happens. it might be that the value you specify to the When: webTitle. is not the actual value with which the method is invoked later on.

If that doesn't work it would be helpful if you post the entire test code so we can try to locate the problem.
answered by lior (13.2k points)
...