How to add items to a list in Rhino Mocks
- by waltid
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?