我建立了一个名为“MemoryDB”的类(其 c'tor 接受 6 个参数)并为她创建了单元测试。直到今天一切正常 - 我尝试删除其中一个参数,所以它们仍然是 5。即使(在重新构建、保存、重新创建 MemoryDB 类等之后),单元测试也无法识别更改并且出现错误消息:TimeTable.DB.MemoryDB does not contain a constructor that takes 5 arguments.
我也尝试重新创建单元测试,但由于某种原因,它创建的自动 c'tor 是旧的 c'tor,有 6 个参数。
我是否以错误的方式删除了论点?我怎样才能解决这个问题?项目中的其他错误是否可能导致这个奇怪的问题?
ps这里是旧的c'tor:
public MemoryDB(List<Grade> allGrades, List<Teacher> allTeachers, ForbiddenHours forbiddenHours, List<Group> allGroups, List<List<Teacher>> staffs, List<List<Group>> parallelGroups)
{
CheckParametersValidation(allGrades, allTeachers, forbiddenHours, allGroups, staffs, parallelGroups);
this.allGrades = allGrades;
this.allTeachers = allTeachers;
this.forbiddenHours = forbiddenHours;
this.allGroups = allGroups;
this.staffs = staffs;
this.parallelGroups = parallelGroups;
}
删除“forbiddenHours”后的新c'tor:
public MemoryDB(List<Grade> allGrades, List<Teacher> allTeachers, List<Group> allGroups, List<List<Teacher>> staffs, List<List<Group>> parallelGroups)
{
CheckParametersValidation(allGrades, allTeachers, allGroups, staffs, parallelGroups);
this.allGrades = allGrades;
this.allTeachers = allTeachers;
this.allGroups = allGroups;
this.staffs = staffs;
this.parallelGroups = parallelGroups;
}