【发布时间】:2014-03-26 03:42:40
【问题描述】:
我正在使用 Visual Studio 2012,但出现以下错误:“错误‘hw02.World’不包含采用 2 个参数的构造函数。我正在尝试为我的类创建单元测试:
class World : IWorld
{
public World(int width, int height)
{
Width = width;
Height = height;
world = new IBuilding[width, height];
}
}
产生错误的测试:
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var world = new World(5, 5); // this line creates the error: 'hw02.World' does not contain a constructor that takes 2 arguments
}
}
感谢您的帮助
【问题讨论】:
-
你确定它在看同一个
World类吗?你的第一堂课肯定是hw02.World?
标签: c# unit-testing visual-studio-2012