TrueWill
unread,Oct 27, 2009, 1:34:26 PM10/27/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Moq Discussions
I have an interface that consists solely of properties. I want to
create a collection containing a number of instances of objects
implementing this interface. Is there an easy way to do it in Moq?
Basically I want to write the equivalent of the following as concisely
as possible, but using a mock (stub) rather than a concrete Foo. The
actual code has more than two properties.
.Returns(new Collection<IFoo>
{
new Foo
{
IsRequired = true,
ItemId = 1
},
new Foo
{
IsRequired = false,
ItemId = 2
}
}
If this isn't possible currently, it might be a nice feature to add.
It would be similar to SetupAllProperties. Thanks!