1

I have a parameter passed into a controller like this

private EnglishForwardLotServiceBase<EnglishForwardLotData, AuctionData, LotFragmentData> englishForwardLotServiceBase;

public EnglishForwardController(
    EnglishForwardLotServiceBase<EnglishForwardLotData, AuctionData, LotFragmentData> englishForwardLotServiceBase)
{
   this.englishForwardLotServiceBase = englishForwardLotServiceBase;
}

The definition of EnglishForwardLotServiceBase is

public class EnglishForwardLotServiceBase<LotData, AuctionData, LotFragmentData> : IEnglishForwardLotService<LotData> where AuctionData : PerfectChannel.Services.EnglishForwardLot.IEnglishForwardLotSetup

So, in my test I am trying to mock englishForwardLotServiceBase like this

IFixture fixture = new Fixture().Customize(new AutoMoqCustomization());
Mock<IEnglishForwardLotService<EnglishForwardLotData>> englishForwardLotServiceBaseMock = fixture.Freeze<Mock<IEnglishForwardLotService<EnglishForwardLotData>>>();

The problem is that Autofiture/Moq is not using a mocked version EnglishForwardLotServiceBase parameter but the actual implementation. This is making my tests fail as you can imagine.

What might be the issue?

TeaDrivenDev
  • 6,591
  • 33
  • 50
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304

0 Answers0