问题
namespace TestBI
{
[TestFixture]
class ClassChild:ClassParent
{
public ClassChild(DataRow row, string name): base(row, detail) { }
[Test]
public void Test()
{
DataRow dr = new DataRow();
dr[0] = 1;
dr[1] = "ram"
ClassChild ch = new ClassChild(dr,"student");
:
:
:
Assert.AreEqual(string1,string2);
}
}
}
When I run the test,i get an error as "TestBI.ChildClass.Test suitable constructor was found"
How do i need to pass parameters here to child class?
回答1:
Provide a zero argument constructor for your test class. It is fine if it calls a multiple argument constructor of the superclass, as long as it provides it with proper arguments.
来源:https://stackoverflow.com/questions/14603570/how-to-perform-nunit-testing-for-a-class-inherting-from-a-base-class-with-parame