Re: [TFUI] Dialogs and EventHandlers
Ron Jeffries <[email protected]> Fri, 4 Nov 2005 19:37:12 -0800
| Newsgroups | gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Message-ID | <[email protected]> |
On Friday, November 4, 2005, at 8:33:13 AM, Cory Foy wrote:
> Recently on the NUnit list someone emailed in trying to figure out how
> to test "private void" methods. Turns out they were wanting to test an
> event handler that opened a FontDialog, which in turn set the font of
> the form.
> While my first reaction was that it was probably easiest to test it
> manually, I decided to give it a shot to create an automated way to test it.
> I'd love you have your feedback on if this would have been the approach
> you would have taken and anything else I could have done differently:
> http://www.cornetdesign.com/2005/11/writing-tests-for-private-void-classes.html
Looks nice ... it felt a little less test-driven than I was
comfortable with, but I don't see a way around that.
In the FontFactory, I might have had the factory contain a default
implementation consisting of an instance of the real font, and
override that with my test instance with a static setter that I
could fire from the test, rather than the boolean.
Whether I did that or not would depend on how much in my way the
language got. I probably wouldn't use reflection, as one of the
notes suggested, in Java, but in Smalltalk, where a class is an
object I might well just store the class in the variable and send in
the message new (since in Smalltalk new is a message, not a
keyword).
Nice.
Ron Jeffries
www.XProgramming.com
Will Turner: This is either madness or brilliance.
Captain Jack Sparrow: It's remarkable how often those two traits coincide.
------------------------ 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:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
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:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/