cab and nunit forms

Topics: CAB & Smart Client Software Factory
Feb 11, 2006 at 6:12 AM
originally posted by: comandante_mc

we tried to test the ui of our application with nunit forms:
nunit expects us to instantiate the form inside the test method and showing it afterwards with Show().
any ideas how to realize this scenario with cab?

Feb 11, 2006 at 9:46 AM
originally posted by: PProvost

I don't have any experience with NUnitForms, but I think what you will have to do to get the dependencies resolved properly is to create a TestableWorkItem (see the unit tests for CAB) and let it create the form so that it gets dependency injected. Then use it from your tests.

Feb 14, 2006 at 1:14 AM
originally posted by: comandante_mc

thank you for responding!
in fact, what we really need is something like a testable application which provides functionality similar to the Run() method of the CabApplication class. with your proposal we can't test the interaction with the Shell, e.g. clicking on menu items. it will also lead to code duplication because we have to implement some of the functionality provided in the CabApplication.Run() method in our test code. do you have any suggestions about checking the interaction with the shell?

Feb 16, 2006 at 5:24 PM
originally posted by: RolandLi

Because the Shell and Items are decoupled by commandHandler or EventHandler, I think You just need to simulate these events to test the item.
To test the shell , you just need to test whether the events are issued correctly.

That's why we use them, it makes test easier, isn't it?

BTW: NUnitForms seems not support the dot net 2.0 yet, so it can't be used with CAB now.