It is because NameValueCollection does not implement IList. This is not
apparent because it just absorbed by ListElement.Eval:

// See: Rhino.Mocks.Constraints.ListElement (v3.5.0.1337)public
override bool 
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean>
*Eval 
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Rhino.Mocks:3.5.0.1337:0b3305902db7183f/Rhino.Mocks.Constraints.ListElement/Eval(Object):Boolean>*(object
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Object>
obj){

    IList 
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Collections.IList>
*list* = obj as IList
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Collections.IList>;
    return (((list != null) && ((this._index
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Rhino.Mocks:3.5.0.1337:0b3305902db7183f/Rhino.Mocks.Constraints.ListElement/_index:Int32>
>= 0) && (this._index
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Rhino.Mocks:3.5.0.1337:0b3305902db7183f/Rhino.Mocks.Constraints.ListElement/_index:Int32>
< list.Count 
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Collections.ICollection/property:Count:Int32>)))
&& this._constraint
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Rhino.Mocks:3.5.0.1337:0b3305902db7183f/Rhino.Mocks.Constraints.ListElement/_constraint:Rhino.Mocks.Constraints.AbstractConstraint>.Eval
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Rhino.Mocks:3.5.0.1337:0b3305902db7183f/Rhino.Mocks.Constraints.AbstractConstraint/Eval(Object):Boolean>(list[this._index
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://Rhino.Mocks:3.5.0.1337:0b3305902db7183f/Rhino.Mocks.Constraints.ListElement/_index:Int32>]));
}


So, even though this compiles:

Arg<NameValueCollection>.List.Element(0, Is.Equal("xxx"))

I get unexpected results.

With that in mind then, is my only option to use GetArgumentsForCallsMadeOn?

<bb/>

2009/8/5 Iain Waddell <[email protected]>

> What am I doing wrong? I am trying to assert a method is being invoked
>> with a NameValueCollection argument containing a specific element
>> value.
>
>
> I think a complete test case would help.
>
> Iain
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to