[Mono-list] Test-suite for System.Collections.SortedList
Nick Drochak
ndrochak@gol.com
Fri, 22 Mar 2002 18:19:43 +0900
| I am new comer in the field of .NET and C#, so I tried out writing a test
| suite as suggested in your web. For me its the first project where I see
| that it is rather easy to start contributing, good job.
Welcome! Glad to hear that it was that easy.
| I attached the test file to the e-mail (SortedListTest.cs). It should be
| placed under:
| msc/class/corlib/Test/System.Collections/SortedListTest.cs
| Of course, a row has to be added into AllTests.cs in that dir.
One comment about the way you used AssertEquals(). You should put the
expected value as the 2nd parameter, and the actual value as the third.
NUnit will provide a nice message saying "...Expected <blah> but got
<halb>.." or some such. So, you don't need to build up your own error
message in AssertEquals().
| All tests passed on my Windows XP Professional box, except the test of
| SortedList.Clear() method:
| - it seems there is a contradiction with the MSDN documentation, which
| claims that the Clear() method leaves the Capacity unchanged, whereas the
| Capacity is altered.
We have a place to document these kind of discrepancies. Please add an
entry to mcs/class/doc/API-notes. You'll see examples there. I also click
that link on the bottom of the MSDN docs to report "feedback" and tell them
directly about it. Both times I did so, I got a reply thank you from
Microsoft. It wasn't just an automated response, mind, it was a real human
being taking the time to thank me. Unusually nice.
| Main ToDos:
| - tests for properties of fixed-size and read-only (tests for catching
| NotSupportedException). I didnt know an easy way to change the initial
| values of these properties in SortedList.
I think unless you construct a SortedList with an IDictionary parameter that
is already fixed-size or read-only, then these will be false. To test this
you will probably have to create your own class that implements IDictionary
and returns true for those methods, then construct a SortedList from that.
I'm not sure if there is a built in class that is fixed-size and implements
IDictionary. Anyone else know?
| - IEnumerable.GetEnumerator [Explicit Interface Implementation].
| Could not
| figure out what to do with such strange thing. :(
You need to call GetEnumerator() on a SortedList to test this. See
TestGetEnumerator() in mcs/class/corlib/Test/ArrayTest.cs for an example of
this.
Thanks and welcome aboard!
Nick D.