This is a migrated thread and some comments may be shown as answers.

Mock.Arrange with matcher does not work

1 Answer 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roland Vonk
Top achievements
Rank 1
Roland Vonk asked on 27 Sep 2012, 07:23 AM
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).

1 Answer, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 01 Oct 2012, 08:35 PM
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.

Tags
General Discussions
Asked by
Roland Vonk
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Share this question
or