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
+1 vote

Class example


     public example()



_localize = new Localize(this);
   if (_localize == null)




Showform f=new Showform ();; //How to hide this form



asked by gnanam (4.7k points)
edited by gnanam

1 Answer

0 votes
Hello gnanam,

If you wish to hide the form, you can use our IgnoreCall() API in your test. This is applicable to void methods only which matches your need.

Isolate.WhenCalled(() =>;

Two more tips:

1. Do not forget to add a reference to System.Windows.Forms in your unit test project.

2. In order to verify that the test works, you can use the Verify API (this would be equivalent to \"Assert\" as a part of the AAA structure in unit testing). Syntax below:

 Isolate.Verify.WasCalledWithAnyArguments(() => f.Show()); //=False

The test should not pass.

Then, you can try

 Isolate.Verify.WasNotCalled(() => f.Show()) //=True

The test should pass now.

Let me know if this helps.


answered by CoralTypemock (940 points)
Another class UI