It is close, but the part I'm haing trouble w/ is mocking the actual arraylist.
so that in effect I end up w/ an indexable, mocked object.
So that rather than having the :
// create list
ArrayList list = new ArrayList();
list.Add(firstMock.Object);
list.Add(secondMock.Object);
code you have something like
// create list
MockList list = new MockList();
list.ExpectIndexAndReturn(0,firstMock.Object);
list.ExpectIndexAndReturn(1,secondMock.Object);
WARNING: the above code snipit is for illustration of the problem and probably won't compile