[Mono-dev] [PATCH] WindowsBase: System.ComponentModel

Chris Toshok toshok at gmail.com
Fri Nov 14 18:35:04 EST 2008


awesome - you have commit access?  If so, go for it.  Otherwise I can get
this in tonight.

chris

On Thu, Nov 13, 2008 at 10:05 PM, Brian O'Keefe <zer0keefie at gmail.com>wrote:

> Ah, I see what you mean now.  Writing unit tests for code you can't see is
> definitely a challenge.
>
> I added the check inside the event handler, and it still passes on the MS
> framework.
>
> Consequently, I made a new patch.
>
> ~Brian
>
> 2008/11/14 Chris Toshok <toshok at gmail.com>
>
>> trying to get this back on the list :)
>>
>> so all the changes look awesome - the one remaining issue is that IsSealed
>> test.  What I meant was in the test where you register a handler
>> (SortDescriptionCollectionAddTest), you should check to see if the
>> SortDescription is sealed *inside* that handler.  Your implementation is
>> sealing it before calling the handler, but there's no test for that.
>>
>> So, something like this:
>>
>> +                       ((INotifyCollectionChanged)sdc).CollectionChanged
>> += delegate (object sender, NotifyCollectionChangedEventArgs e) {
>> +                               Assert.AreEqual
>> (NotifyCollectionChangedAction.Add, e.Action, "ADD_#0");
>> +                               addedItem = (SortDescription)e.NewItems
>> [0];
>> ++                             Assert.IsTrue (addedItem.IsSealed,
>> "ADD_#0.5");
>> +                       };
>>
>> Chris
>>
>>
>> On Wed, Nov 12, 2008 at 5:36 PM, Brian O'Keefe <zer0keefie at gmail.com>wrote:
>>
>>> Hello,
>>>
>>> I updated my patch to fix the problems you mentioned.  I'll attach the
>>> new one.
>>>
>>> In SortDescription:
>>>>
>>>>    1. Null checks for Name, both in the property setter and ctor.  If
>>>>    null is permitted there, add a check for the ==/!= operators using them,
>>>>    because currently yours will throw NRE.
>>>>    2. Property setter tests on a Sealed SortDescription.  do they throw
>>>>    InvalidOperationException?
>>>>
>>>> I missed this one completely.  I fixed the NREs.  According to MSDN,
>>> null and empty values aren't allowed, but they're both accepted as input.  I
>>> made my implementation compatible with the Microsoft implementation.
>>>
>>> There was another exception I had overlooked:
>>> InvalidEnumArgumentException.  Apparently the MS framework throws these if
>>> you try to pass in a direction that's not ascending or descending.  Mine
>>> does it too now.
>>>
>>>
>>>> In CurrentChangingEventArgs:
>>>>
>>>>    1. Need a test to see if setting args.Cancel to true throws an
>>>>    exception when IsCancelable is false.
>>>>
>>>> Added the test for that, and fixed my code to match  the MS
>>> implementation.
>>>
>>>
>>>> In SortDescriptionCollection:
>>>>
>>>>    1. need to verify that the item is actually sealed before the
>>>>    CollectionChanged handler is called.  I didn't see a test that checks that.
>>>>
>>>> Added a test for that, which I think does the right thing.  I don't
>>> subscribe to CollectionChanged, and the SortDescription is still sealed.
>>>
>>>
>>>> Please don't reformat code in patches (particularly whitespace/line
>>>> wrapping things) that contain actual code changes, unless it's absolutely
>>>> necessary.  It makes it much harder to see substantive changes.
>>>>
>>>
>>> Sorry about that one; Visual Studio was being difficult.  I unchanged the
>>> formatting I changed accidentally.
>>>
>>> ~Brian
>>>
>>
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081114/badfa621/attachment.html 


More information about the Mono-devel-list mailing list