Chapter 10. Find a Bug, Write a Test
Last time out, I found a bug. Our rules of engagement require us to write a test, first to show that the bug exists and later to verify that we have fixed it, but we don’t know how to write that test! We get by with a little help from our friends.
Oh No, There’s a Bug!
In the previous chapter, I found a defect in the program: when insertion of a new set of paragraph tags takes you below the bottom of the window, the text doesn’t scroll up to keep the cursor on the screen. You have to keep clicking on the scroll bars to bring the line back up.
It took me only a little while to find and fix the defect. Here’s the code, from the XMLNotepad class, with the fix. That’s what we’re going to work on today:
void XMLKeyDownHandler(object ...
Get Extreme Programming Adventures in C# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.