删除参数后出错(“方法参数”错误)

时间:2013-01-18 10:05:45

标签: c# visual-studio-2010 constructor arguments

我已经构建了一个名为“MemoryDB”的类(其中c'tor需要6个参数)并为她创建了单元测试。 一切都还行,直到今天 - 我尝试删除其中一个参数,所以它们保持为5.即使(在重新构建,保存,重新创​​建类MemoryDB等之后),单元测试也无法识别变化和出现错误消息:TimeTable.DB.MemoryDB does not contain a constructor that takes 5 arguments. 我也尝试重新创建单元测试,但由于某种原因,它创建的自动c'tor是旧的c'tor,有6个参数。

我是否以错误的方式删除了参数?我怎样才能解决这个问题?项目中的其他错误可能会导致这个奇怪的问题吗?

P.S。这是老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;
    }

新的c'tor,删除“forbiddenHours”后:

    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;
    }

0 个答案:

没有答案