Mock.Arrange<>

4 posts, 0 answers
  1. oliwa
    oliwa avatar
    18 posts
    Member since:
    Jul 2009

    Posted 16 Apr 2012 Link to this post

    How do you use this?
  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 17 Apr 2012 Link to this post

    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 >>

  3. DevCraft R3 2016 release webinar banner
  4. oliwa
    oliwa avatar
    18 posts
    Member since:
    Jul 2009

    Posted 18 Apr 2012 Link to this post

    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
  5. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 19 Apr 2012 Link to this post

    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 >>

Back to Top