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
Hi

how about allowing us to verify only one method something like

mock.Verify("methodName")
asked by tolisss (28.8k points)

8 Answers

0 votes
how about allowing us to verify only one method


Hi,
What is the behaviour that you are missing?
Do you mean VerifyAlways? Why is ExpectCallAndVerify not enough?
answered by scott (32k points)
0 votes
Hi excellent support!!!

i didn't think of ExpectCallAndVerify and i suppose in some cases it can be used but i cannot know if i can use it for methods that have return types or for index properties
answered by tolisss (28.8k points)
0 votes
Hi excellent support!!!

Thanks :)
i cannot know if i can use it for methods that have return types or for index properties


You can use it for methods with return types, but there are currently no api's for properties and indexes.

:idea: In any case if you return MockManager.CONTINUE_WITH_METHOD the method will be in verify mode (you can return this for void methods too!!!). So this is a workaround for verifying get of properties and indexes.
Take a look at the Verify section of the online help (Verify Mode)
answered by scott (32k points)
0 votes
i still confused let me describe better what i want to acheive
mock.ExpectCall("method1");
mock.ExpectGetAlways("propName",value);


i want to verify that method1 is called (and mock it) but i do not want to rewrite the 2nd expectation. imagine having the above code in the setup method of a fixture and want to verify the method1 inside SetUp but to keep the 2nd expectation for using it by the rest of the test cases.

i now using a technic like the following
mock.ExpectCall("method1");
mock.ExpectGetAlways("propName",value);
....
....
do stuff

mock.Verify()

mock.ExpectGetAlways("propName",value);


but that makes my expectations spread around the code and being doublicate
answered by tolisss (28.8k points)
0 votes
Ok,
I understand your request better now.
You need a VerifyAndKeepAlwaysExpectations or perhaps a VerifyAndKeepStubs.
:?: Just a question, why not verify the mocks at the end of the test? Normally Test Driven Development practices says that you should have one test per method.
answered by scott (32k points)
0 votes
Just a question, why not verify the mocks at the end of the test?

yes i could do that as well but in some cases cuase i m not following exactly Normally Test Driven Development practices and i think is very difficult to follow them when u TDD GUI that have large setup methods and also i m a TDD newbie
answered by tolisss (28.8k points)
0 votes
Ok,
I will add this request to our list.

:!: GUI is VERY hard to test. :-)
Good luck
answered by scott (32k points)
0 votes
This is supported in version 3.1
use VerifyMode.DontClear (see Advanced Stubs)
answered by scott (32k points)
...