How to add items to a list in Rhino Mocks
Posted
by waltid
on Stack Overflow
See other posts from Stack Overflow
or by waltid
Published on 2010-05-26T08:19:19Z
Indexed on
2010/05/26
8:41 UTC
Read the original article
Hit count: 314
c#
|rhino-mocks
I have method (which is part of IMyInteface) like this:
interface IMyInterface
{
void MyMethod(IList<Foo> list);
}
I have the ClassUnderTest:
class ClassUnderTest
{
IMyInterface Bar {get; set;}
bool AMethod()
{
var list = new List<Foo>();
Bar.MyMethod(list);
return list.Count()>0;
}
My Test with Rhino Mocks looks like this:
var mocks = new MockRepository();
var myMock = mocks.StrictMock<IMyInterface>();
var myList = new List<Foo>();
var cUT = new ClassUnderTest();
cUT = myMock;
myMock.MyMethod(myList);
//How can I add some items to myList in the mock?
mocks.Replay(myMock);
var result = cUt.AMethod();
Assert.AreEqual(True, result);
How can I now add some items to myList in the mock?
© Stack Overflow or respective owner