当我调试代码并阅读带有 mockLessonplannerAFactory 创建的行时,我收到错误:
不能为接口模拟传递构造函数参数。
var mockSchoolclassCodeService = new Mock<ISchoolclassCodeService>();
var mockDateService = new Mock<IDateService>();
var mockLessonplannerAFactory = new Mock<ILessonplannerAFactory>(mockDateService.Object);
var mockLessonplannerBFactory = new Mock<ILessonplannerBFactory>(mockDateService.Object);
var service = new TimeTableService(mockUnitOfWork.Object, mockLessonplannerAFactory.Object, mockLessonplannerBFactory.Object, mockSchoolclassCodeService.Object);
我的 TimeTableService 只接受接口类型的实例。但是 mockLessonplannerAFactory 和 BFactory... 想要在他们的构造函数中也传递一个 IDateService。
我的代码有什么问题?