Say I have an interface like this.
public interface ICamProcRepository
{
List<IAitoeRedCell> GetAllAitoeRedCells();
IAitoeRedCell CreateAitoeRedCell();
}
How do I mock the method which return an interface and a list of interface objects. I am using Ninject.MockingKernel.Moq
var mockingKernel = new MoqMockingKernel();
var camProcRepositoryMock = mockingKernel.GetMock<ICamProcRepository>();
camProcRepositoryMock.Setup(e => e.GetAllAitoeRedCells()).Returns(?????WHAT HERE?????);
camProcRepositoryMock.Setup(e => e.CreateAitoeRedCell()).Returns(?????WHAT HERE?????);
In your case you need to create mocks of the desired results for the mocked interface in question and pass them into the Returns
of its setups, either via kernel or straight moq. I don't know Ninject to be able to help you there but here is a plain Moq example
var mockingKernel = new MoqMockingKernel();
var camProcRepositoryMock = mockingKernel.GetMock<ICamProcRepository>();
var fakeList = new List<IAitoeRedCell>();
//You can either leave the list empty or populate it with mocks.
//for(int i = 0; i < 5; i++) {
// fakeList.Add(Mock.Of<IAitoeRedCell>());
//}
camProcRepositoryMock.Setup(e => e.GetAllAitoeRedCells()).Returns(fakeList);
camProcRepositoryMock.Setup(e => e.CreateAitoeRedCell()).Returns(() => Mock.Of<IAitoeRedCell>());
If the mocked objects need to provide fake functionality as well then the too will have to be setup accordingly.