First Improvements

Our original plan was to create a GUI instance, run it, and pump fake typed characters at it. We tried a number of different ways to do that, and none of them worked. So we decided to do something that moves in that direction but not quite so far. We created an instance of the Form and held on to both the Form and the model in our test. Then we simulated a KeyDown event in the Form, when the test asked for *enter. The code looks like this:

 if ( line == "*enter") 
form.XMLKeyDownHandler((object) this, new KeyEventArgs(Keys.Enter));

That s nearly good! The actual key handler is running and sending model.Enter(). That s as good as it could get for that case, so we went ahead and sent an Alt+S through, to test the EnterSectionTags():

 if ( line == "*altS") 
form.XMLKeyDownHandler((object) this, new KeyEventArgs(Keys.Alt Keys.S));

How clever and simple. Unfortunately, it doesn t work. Sending the key through that way doesn t drive the menus, which are supporting the accelerators like Alt+S. Gack. Maybe we should give up. We ll just be careful to build all the menus correctly, OK?

Extreme Programming Adventures in C#
Javaв„ў EE 5 Tutorial, The (3rd Edition)
ISBN: 735619492
EAN: 2147483647
Year: 2006
Pages: 291 © 2008-2017.
If you may any questions please contact us: