Chapter 7: Warts and All


Sometimes the bear bites you. Today it bit Ron and Chet. But we learned some lessons, and we ll share them with you.

Enhancing the Customer Tests

In the preceding chapter, we got our first Customer Acceptance Test working, and it was clear that our customer could do more tests. So we did a couple more and sure enough they all ran. But we knew there was something we couldn t test, so we came up with this test as an example:

 *input 
<P>This is the first paragraph.</P>
<P>This is the second paragraph.</P>
*end
*enter
*output
<P>This is the first paragraph.</P>
<P></P>
<P>This is the second paragraph.</P>

The tricky bit is in the first line: < P > This is the first paragraph. < /P >. See that vertical bar? The customer wants to write a test that shows that if the cursor is in the first line and he presses Enter, the editor inserts a blank paragraph tag in between the first and second lines, with the cursor in the middle of it. Now, it turns out that the TextModel actually works that way: we can run the GUI and show it. But we can t test that feature of the TextModel, because we don t set the SelectionStart property when we read the input.

Our mission is simple. We need to parse the input lines a little bit, remove the vertical bar from the input (because it isn t really there, it s just a cursor), and remember where it was so that we can set the SelectionStart property.

The following are the results of that trial, and trial it was.




Extreme Programming Adventures in C#
Javaв„ў EE 5 Tutorial, The (3rd Edition)
ISBN: 735619492
EAN: 2147483647
Year: 2006
Pages: 291

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net