【发布时间】:2014-10-22 13:15:57
【问题描述】:
我正在为 toString 方法编写 unitTest 寻求帮助。我的属性和构造函数单元测试进展顺利,但我们没有了解方法的单元测试。任何人都可以帮忙吗?如果需要更多上下文,请告诉我。待测方法如下:
public override string ToString()
{
return string.Format("{0}; is a {1} with a resolution of {2} and uses a {3} for media storage",
base.ToString(), this.Type, this.MegaPixels, this.MediaStorage);
}
还有base.toString():
public override string ToString()
{
return string.Format("{0}-{1}; {2}, {3}, {4}; {5} MSRP: {6} Cost: {7}",
this.Type, this.PartNumber, this.Brand, this.Series, this.Model,
this.Description, this.MSRP, this.Cost);
}
谢谢
【问题讨论】:
标签: c# unit-testing methods tostring