Re: [TFUI] Dialogs and EventHandlers
Owen Rogers <[email protected]> Mon, 7 Nov 2005 22:02:29 -0800
| Newsgroups | gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Message-ID | <[email protected]> |
hi anthony, On 07/11/05, Anthony Williams <[email protected]> wrote: > The key difference is that I believe the GetFontFromUserSelection function > does not belong on the MyForm class, so I would extract it to a collaborator > instead of mocking the FontDialog. just to play devil's advocate here: - it now looks like all of the functionality has been extracted to the SelectFontUsingFontDialog class. so what are we really testing here (aside from the event handler calling the collaborator correctly)? i can see the value from a design perspective, but the original question was how to test it. > We can then test the SelectFontUsingFontDialog class separately — since it now has a simpler interface, and a clearer responsibility, this is easier than testing the original code. so, how might we do this then? isn't this the crux of TFUI and also the intent of the original question? also, is the interface necessarily better? what if we wanted to act differently if the DialogResult was OK? how would that impact the design? > I might even decide it was "too simple to break", since all it does is call a library component to select the font. is this a cop-out? this code we deemed "too simple to break" looks more complicated than the code that we did write a test for. > In particular, I feel that if you have a function that needs to ask the user for a choice here and now, in order to perform some operation, then the responsibility for obtaining the user's choice does not belong with that function, and probably doesn't belong with the function's containing class either. i agree. but what if the dialog was not modal? how would we handle this situation? raising events from the dialog class? to clarify: i'm not trying to poke holes in your article; i'm just interested in exploring this issue. cheers, owen. -- Owen Rogers | http://dotnetjunkies.com/weblog/exortech | CruiseControl.NET - http://ccnet.thoughtworks.com ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM --------------------------------------------------------------------~-> To unsubscribe, email: [email protected] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/TestFirstUserInterfaces/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/