visual studio – Can not instantiate proxy of class Could not find a constructor that would match given arguments


The fix was to remove the transLogger object when creating the transmissionsRepository mock. Because Mock takes a params[] argument, you can pass any number of erroneous additional properties and Visual Studio won’t provide intellisense telling you you’ve done something wrong because it has no way of knowing.

so I had to change this line:

transmissionsRepository = new Mock<TransmissionsRepository>(transmissionsContext, httpContextAccessor.Object, transLogger.Object);

to:

transmissionsRepository = new Mock<TransmissionsRepository>(transmissionsContext, httpContextAccessor.Object);

Leave a Reply

Your email address will not be published. Required fields are marked *