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
0 votes
I use the following code:
Mock fM=MockManager.Mock(typeof(MyForm), Constructor.NotMocked));
fM.ExpectAndReturn("ShowDialog", DialogResult.OK);

MyForm frm=new MyForm();
DialogResult res=frm.ShowDialog();

The code fails with TypeMock exception:
"ShowDialog has 1 more expected calls"

Toyota Innova specifications
asked by PowerBoots (640 points)

3 Answers

0 votes

This should work.
Try to isolate the problem by running this test alone.
look at the tracer and see if everything is in order (ill send you a mail with instructions on how to produce the tracer output so you can send it to us)

Are you able to mock other objects without any problems?
answered by lior (13.2k points)
0 votes
Hi Lior,

To your question:
1) I run this test alone, I am a beginner, I don't have other tests
2) I created a very simple class that outputs a MessageBox to the screen, I played around with TypeMock and it works fine. TypeMock is realy great!
3) I don't know how to start the tracer. Thanks in advance for instructions.
4) I have to test some legacy code. I try to use TypeMock to mock all calls to System.Windows.Forms so I can concentrate on unit testing the buisness logic. Do you think it can work?
Dan Lupu :)
answered by PowerBoots (640 points)
0 votes
Lets take this offline. ive sent you a mail with instructions on how to produce the trace we will continue from there.
answered by lior (13.2k points)