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
+2 votes
Hi please find the below example

Example  class File

Public Class AAAA

{

Public AAAA()

{

    BBBB ex=new BBBB(this);

     Ex.show();    

}

}

Public Class BBBB

{

Public BBBB()

{

    --------

}

}

Testcase

Example.cs

[TestClass]

Public class unittest

{

                [TestMethod]

                public void GenerateReport_Module()

                  {

                                AAAA  UIval=new AAAA();

                                Isolate.WhenCalled(() => UIval. Createval(rArgs)).WithExactArguments()

                    }                         

}

In above test case whenever I am creating AAAA class object means BBBB  UI will show automatically.

So I need to hide BBBB Screen
related to an answer for: Another class UI
asked by gnanam (5.2k points)

2 Answers

0 votes
Hi ganam,

Since the BBBB object is created in AAAA\'s constructor, you need to use Isolate.Fake.NextInstance();

 You can use it like this:

var fake = Isolate.Fake.NextInstance<BBBB>();

Isolate.WhenCalled(() => fake.Show()).IgnoreCall();

Cheers,

Sapir.
answered by SapirTypemock (3.2k points)
0 votes
Hi ganam,

Was the suggestion helpful for you?

Cheers,

Sapir.
answered by SapirTypemock (3.2k points)

thanks for your update. now code is wrking ... 

Hi ganam,

I\'m glad to hear that!

Don\'t hesitate to contact us if there is anything else you need.

Cheers,

Sapir.
...