[Mono-dev] [Patch] NameObjectCollectionBase, HttpCookieCollection
Gert Driesen
gert.driesen at telenet.be
Thu Dec 20 12:44:54 EST 2007
Hi Juraj,
I made some adjustments to your tests to get them to pass on both .NET 2.0
(SP1) and .NET 1.1.
I also improved some existing tests that may require additional changes
before they pass on Mono.
Gert
PS. Sorry if the attachment is binary (Outlook, says it all ...).
-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Juraj
Skripsky
Sent: donderdag 20 december 2007 10:38
To: Gert Driesen
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] [Patch]
NameObjectCollectionBase,HttpCookieCollection
Hi Gert,
I'm attaching my patches, updated as per your suggestions.
- Juraj
On Thu, 2007-12-20 at 10:06 +0100, Gert Driesen wrote:
> Hi Juraj,
>
> I'd advise against using ExpectedException when multiple calls are
> made in the test, as this may lead to false positives.
>
> For example:
>
> [Test]
> [ExpectedException (typeof (ArgumentException))]
> public void CopyTo_NotEnoughSpace ()
> {
> string [] array = new string [4];
> UnitTestNameObjectCollectionBase c = new
> UnitTestNameObjectCollectionBase ();
> c.Add ("1", "mono");
> c.Add ("2", "MoNo");
> c.Add ("3", "mOnO");
> c.Add ("4", "MONO");
> ((ICollection)c).CopyTo (array, 2);
> }
>
> If any of the Add methods would lead to an ArgumentException, the test
> would pass although you explicitly wanted to check if CopyTo resulted
> in an ArgumentException.
>
> I would advise the following code (which is more bloated, yes):
>
> [Test]
> public void CopyTo_NotEnoughSpace ()
> {
> string [] array = new string [4];
> UnitTestNameObjectCollectionBase c = new
> UnitTestNameObjectCollectionBase ();
> c.Add ("1", "mono");
> c.Add ("2", "MoNo");
> c.Add ("3", "mOnO");
> c.Add ("4", "MONO");
> try {
> ((ICollection)c).CopyTo (array, 2);
> Assert.Fail ("#1");
> } catch (ArgumentException ex) {
> Assert.AreEqual (typeof (ArgumentException),
ex.GetType (), "#2");
> Assert.IsNull (ex.InnerException, "#3");
> Assert.IsNotNull (ex.Message, "#4");
> Assert.IsNull (ex.ParamName, "#5");
> }
> }
>
> This also allows you to perform additional checks (eg. was there an
> inner exception?).
>
> Gert
>
> -----Original Message-----
> From: mono-devel-list-bounces at lists.ximian.com
> [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Juraj
> Skripsky
> Sent: woensdag 19 december 2007 11:27
> To: mono-devel-list at lists.ximian.com
> Subject: [Mono-dev] [Patch] NameObjectCollectionBase,
> HttpCookieCollection
>
> Hello,
>
> Attached are three small patches for NameObjectCollectionBase.cs,
> NameObjectCollectionBaseTest.cs and HttpCookieCollection.cs.
>
> All unit tests pass on Mono. Could someone verify that the new unit
> tests work on MS.NET?
>
> May I commit?
>
> - Juraj
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NameObjectCollectionBaseTest.patch
Type: application/octet-stream
Size: 8471 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071220/72dc622d/attachment.obj
More information about the Mono-devel-list
mailing list