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 want to fake an output of a public static method.

i.e.

Isolate.WhenCalled(() => DummyClass(param1, out param2)).WithExactArguments().DoInstead(

c =>

{

   var param1 = c.Parameters[1] as string

   param1 = "fake output";

   return false;

});

However, the param2 don't get the "fake ouput" value in the above code. Is there anything we can do ?
asked by (36.1k points)

1 Answer

+1 vote
public void Out_Param_Example()
{
    //Arrrange
    int val = 5;
    Isolate.WhenCalled(() => DummyClass.DummyMethod(0, out val)).WillReturn(false);

    //Act
    int returnedVal;
    var result = DummyClass.DummyMethod(0, out returnedVal);

    //Assert
    Assert.AreEqual(val, returnedVal);
}

You can find more examples in our documentation

answered by (18k points)
...