Mock.Arrange with matcher does not work

2 posts, 0 answers
  1. Roland Vonk
    Roland Vonk avatar
    20 posts
    Member since:
    Jan 2004

    Posted 27 Sep 2012 Link to this post

    I'm trying to mock a method call with a matcher, but JustMock fails to intercept the call properly. This is a test that fails for me:

    [Fact]
    public void ArrangeDoesNotMatchArguments()
    {
        string value1 = "Hello";
        string value2 = "World";
     
        var session = Mock.Create<IMockable>();
     
        Mock.Arrange(() => session.Get<string>(Arg.Matches<string[]>(v => v.Contains("Lol") &&
                                                 v.Contains("cakes"))))
            .Returns(new[]
                     {
                         value1,
                         value2,
                     });
     
        var testValues = new[]
                         {
                             "Lol",
                             "cakes"
                         };
     
        var result = session.Get<string>(testValues);
     
        Assert.Contains(value1, result);
        Assert.Contains(value2, result);
    }
     
    public interface IMockable
    {
        T[] Get<T>(params string[] values);
    }
    I'm using JustMock Q2 2012 SP1 (2012.2.813.9).
  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 01 Oct 2012 Link to this post

    Hi Ronald,
    Thanks again for contacting us.

    We however able to identify the issue and should you need a fix a urgently please create a support ticket where i will send you the latest build.


    Kind Regards
    Ricky
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top