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

I searched through the forums but could not find any other topic related to my my problem. If this question has already been answered please redirect me to the link.

I am trying to fake a method with an 'out' parameter.

After reading the online developers documentation I wrote a small test similar to the following.

        class ClassUnderTest
            public bool GetCount(out int count)
                count = -1;
                return false;

        public void Test()
            int count = 100;
            ClassUnderTest cut = Isolate.Fake.Instance<ClassUnderTest>();
            Isolate.WhenCalled(() => cut.GetCount(out count)).WillReturn(true);

            int countValue;
            cut.GetCount(out countValue);

            Assert.That(countValue, Is.EqualTo(100));

I would expect that this test would succeed but in fact it does not. The value returned in the out parameter is 0.

Can you please tell me what I might be doing wrong?

Thank you,

asked by Darin_Creason (3.5k points)

2 Answers

0 votes
I should like to add that I am using Isolator v5.3.0 on VS2008 with TestDriven.NET 2.19.2409.


answered by Darin_Creason (3.5k points)
0 votes
Hi Darin,

its seems like his is a known bug,
look here at Ohad's reply.
answered by error (6.6k points)