This is a migrated thread and some comments may be shown as answers.
Mock.Arrange<>
3 Answers 73 Views
This is a migrated thread and some comments may be shown as answers.
oliwa
Top achievements
Rank 1
oliwa asked on 17 Apr 2012, 03:12 AM
How do you use this?

3 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 17 Apr 2012, 10:13 PM
Hi Brian,

Thanks again for contacting us. 

According to your post it looks to me that you are interested in knowing the usage of Mock.Arrage.I would request you to go through the following section in online documentation which will provide the necessary information in understanding it:

http://www.telerik.com/help/justmock/basic-usage.html

Kind Regards
Ricky
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
oliwa
Top achievements
Rank 1
answered on 18 Apr 2012, 12:32 PM
My question was for the generic version of Mock.Arrange.  I looked through the help and there is no mention of it.

For example, when would I do...

Mock.Arrange<int, bool>(x => _Foo.Bar(x)).Returns(true);

And how is x set?

Thanks
0
Ricky
Telerik team
answered on 19 Apr 2012, 09:43 PM
Hi Brian,

Thanks again for contacting us. In terms of mocking a method that accepts an integer value and returns a boolean value. It is always possible to do this:

Mock.Arrange(() => foo.Bar(10)).Returns(true);

Here foo is the mocked instance from Mock.Create<Foo>(). 

In addition, you can specify matchers in this way for the same syntax:

Mock.Arrange(() => foo.Bar(Arg.Matches<int>(x => x == 10)).Returns(true);

Therefore the following syntax is not necessary to mock a call.

Mock.Arrange<int, bool>(x => _Foo.Bar(x)).Returns(true);


Please let me know if I am missing something or you can point me to the exact problem you are facing so that I can help you out.

Kind Regards
Ricky
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Asked by
oliwa
Top achievements
Rank 1
Answers by
Ricky
Telerik team
oliwa
Top achievements
Rank 1
Share this question
or