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've a method to test which further calls another method that has some arguments. I want to check the value of these arguments/variables, as they are local to test method, I got no way to test these value.
There could be some way to test the argument values of a method that i am mocking.

asked by sony (7.2k points)

3 Answers

0 votes
Hi Sony,

I didn't quite understand the problem.
Can you use:


If not, can you post a code example showing the problem at hand?

TypeMock Support
answered by yonatan (1.6k points)
0 votes
Thanks for your reply,

I've a method which i want to test, after some processing another method get called with some arguments, i want to test the values of these arguments(variables as the result of computation in my test method).

example is

Email = User.Email;
user.UserType = isAdmin? UserType.SuperAdmin: UserType.Operator;
//argument to be checked is user.UserType and Email

This is the simplest example, real scenario is somewhat complex. but if you suggest me something by which i could get the value of arguments in ProcessUser method, it'll do.

answered by sony (7.2k points)
0 votes
Hi Sony,

Assuming that you know what will be the values of the arguments, you can use WasCalledWithExactArguments method.
// call code under test

// verification is done after the code under test gets called.
Isolate.Verify.WasCalledWithExactArguments(() => fake.ProcessUser("", UserType.Operator));

The test above will pass only if ProcessUser gets called with the values:
"" and UserType.Operator

Please let me know if it helps.
answered by ohad (35.5k points)