|
From: Xiaoqiao Li <xia...@ya...> - 2004-05-24 05:39:40
|
Cool. It works for me.
Thanks.
Xiaoqiao
Steve Freeman <st...@m3...> wrote:
Try using an IsArrayEqual constraint.
mock.Expect("Bar", new IsArrayEqual(expectedList));
or something like that.
S
Xiaoqiao Li wrote:
> Hi,
>
> How does Mock.Expect verify ArrayList parameters? ArrayList.Equals is
> inherited from Object and compares reference, not content. But my
> unit test needs to compare the content, similar to the behavoir in
> Java - first compare the list size, and then call equals on each
> element.
>
> IMock mock = new DynamicMock(typeof(IFoo); IFoo foo = (IFoo)
> mock.MockInstance;
>
> ArrayList expectedList = new ArrayList(); expectedList.Add(1);
> expectedList.Add(2); mock.Expect("Bar", expectedList );
>
> FooUser user = new FooUser(foo); user.DoSomething(); //
> foo.Bar(actualList) is called in user.DoSomething()
>
> mock.Verify();
>
> I'd like to have the above test pass. The actualList is generated
> inside user.DoSomething(), so I cannot set expectedList = actualList.
>
>
> The ArrayList parameter is not uncommon. I think there must be a way
> in nmock. Can someone shed light on this? Thanks.
>
> Xiaoqiao
>
> --------------------------------- Do you Yahoo!? Yahoo! Domains -
> Claim yours for only $14.70/year
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Nmock-general mailing list
Nmo...@li...
https://lists.sourceforge.net/lists/listinfo/nmock-general
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year |