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

Hi,

I still get this AndArgumentsMatch exception after applying patch TypemockIsolatorSetup_602_q273.msi.

Here's the production code

    public interface ISpectralResponseCurve
    {
        double SpectralAcceleration(double period, double dampingRatio);
        double SpectralDisplacement(double period, double dampingRatio);
    }


And here's the test code:

    var curve = Isolate.Fake.Instance<ISpectralResponseCurve>(Members.CallOriginal, ConstructorWillBe.Ignored);
            Isolate.WhenCalled((double period, double dampingRatio) => curve.SpectralAcceleration(0, 0))
                .AndArgumentsMatch((period, dampingRatio) => period == 1.0).WillReturn(0.85 * 386.4);


The exception I got was:

failed: TypeMock.TypeMockException :
*** All argument matching parameters should be used on the same method.
at hd.a()
at hd.a(Int32& A_0)
at f6.d()
at c8.a(Boolean A_0)
at dd.b(Boolean A_0)
at ib.c(Boolean A_0)
at ib.a(Object A_0, Boolean A_1, Func`1 A_2, Action A_3, Action A_4, Action A_5)
at ib.c(Object A_0)


Any idea?
 

asked by nsoonhui (59.1k points)
edited by Bar

1 Answer

0 votes
Hi Soon Hui,

When matching arguments, all argument matching variables (the ones you pass in to the WhenCalled() lambda expression) need to be used on the same method in the expression. In this statement:
Isolate.WhenCalled((double period, double dampingRatio) => curve.SpectralAcceleration(0, 0))... 

the variables period and dampingRatio are not used. Replacing that call with the following should work:
Isolate.WhenCalled((double period, double dampingRatio) => curve.SpectralAcceleration(period, dampingRatio)) 


Doron
Typemock Support
answered by doron (16.5k points)
...