[Mono-list] First NUnit contribution

Nick Drochak ndrochak@gol.com
Wed, 29 May 2002 12:21:43 +0900


| -----Original Message-----
| From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
| Behalf Of Michael Riegger
| Sent: Wednesday, May 29, 2002 4:25 AM
| To: Mono
| Subject: [Mono-list] First NUnit contribution
|
|
| This is the first NUnit test case I've written, it is for the
| UnicodeEncoding class in System.Text
| and I was hoping to get some feedback on it. It runs without
| problems on both windows and cygwin
| mono. The major thing it is missing is testing for invalid
| surrogates, as I am having trouble
| finding a case that would get the Windows library to throw one
| when encountered. Any advice you
| can give is appreciated.
|

I'll just make a quick comment (or two), since I don't have time to
carefully read the whole thing.

1) Use a string message as the first parameter of your Assert*() methods
when there is more than one per Test method. This will make it much easier
to tell where the test is failing.

2) The order of the parameters is important.  The expected value comes
before the actual value.  NUnit gives a nice message when the assert fails,
like "Expected <42> but got <69>".

So, you should have something like: AssertEquals("A#45", 42,
myAnswerToLifeEtc)

Regards,
Nick D.