Mocking Indexer

519 views
Skip to first unread message

CVertex

unread,
May 28, 2008, 4:21:47 AM5/28/08
to MoQ Discussions
How do I mock an indexer?

Great work on Moq.

-V

Daniel Cazzulino

unread,
May 28, 2008, 12:25:55 PM5/28/08
to moq...@googlegroups.com
var mock = new Mock<IIndexed>();

mock.Expect(i => i[0]).Returns("foo");
mock.Expect(i => i[1]).Returns("bar");

should work

CVertex

unread,
May 28, 2008, 7:57:05 PM5/28/08
to MoQ Discussions
Awesome! Thanks Daniel!

Always amazed by your work.

On May 29, 2:25 am, "Daniel Cazzulino" <dan...@cazzulino.com> wrote:
> var mock = new Mock<IIndexed>();
>
> mock.Expect(i => i[0]).Returns("foo");
> mock.Expect(i => i[1]).Returns("bar");
>
> should work
>

Daniel Cazzulino

unread,
May 29, 2008, 1:29:11 AM5/29/08
to moq...@googlegroups.com
thanks! :)
Reply all
Reply to author
Forward
0 new messages