samedi 3 septembre 2016

Mock a method returning an interface with NInject Mocking Kernel

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?????);

Aucun commentaire:

Enregistrer un commentaire