1 Dec 2004 18:16
Testing ToString()
Roman Gavrilov <RGavrilov <at> fischerimaging.com>
2004-12-01 17:16:39 GMT
2004-12-01 17:16:39 GMT
I have a simple class that represents X-Y point, that implements ToString() that yields string-representation of the object. How do I test the ToString() method? Here are options I've considered: 1. Hardcode expected result as in "X=1.0 Y=2.0" - does not address issue of localization. 2. Create expected result using API tools - this adds some complexity to the test case. 3. Verify that assumed locale is set and then run the testcase or yield warning and skip the test if different local selected. Any ideas? Roman V. Gavrilov ******************* IMPORTANT MESSAGE ******************************* Internet communications are not secure and therefore, Fischer Imaging does not accept legal responsibility for the contents of this message including any material attached to it. Any views or opinions presented are solely those of the author and do not necessarily represent those of Fischer Imaging, unless otherwise specifically stated. This email is confidential and may be legally privileged. The copying, broadcasting, publishing or dissemination electronically or by any other means of the contents of this email or its attachments is prohibited, unless expressly authorized by the sender. It is the responsibility of the recipient to ensure that they have virus protection and no responsibility is accepted by Fischer Imaging for any loss or damage arising in any way from receipt or use thereof of this email or its attachments.(Continue reading)
_____
From: Mikhail Shnayderman [mailto:mschnayd <at> yahoo.com]
Sent: Thursday, 2 December 2004 11:22 a.m.
To: testdrivendevelopment <at> yahoogroups.com
Subject: RE: [TDD] Testing ToString()
To me Option 2 seems also the most reasonable.
I would also try to make a point that if it is
possible
to change the X-T point class, so that Locale
information is not used as a system-wide (global)
value, but is rather passed to the X-Y point; you may
have an easier time in testing.
I do see that this maybe a design smell, and you may
not want your X-Y point (possibly a domain concept) to
depend explicitly in its X-Y point interface on
Locale.
RSS Feed