【发布时间】:2013-09-11 03:46:02
【问题描述】:
我有一个“患者信息”类,其中包括变量,例如名字、姓氏、年龄、体重、身高、性别……。这些变量中的每一个也都有 get 和 set 方法。 另一个类“程序有以下方法
public double weightCalc(patientinfo p3)
{
if (p3.getGender() == "male" || (p3.getGender() == "MALE")
{
//Calculate ideal body weight
idealWeight = (50 + (2.3 * (p3.getheight() - 60)));
}
else
{
//Calculate ideal body weight
idealWeight = (45.5 + (2.3 * (p3.getheight() - 60)));
}
return idealWeight;
我必须为此方法为 NUnit 准备一个测试用例。由于我是一个基础学习者,期待有关如何在测试类中传递 height 或 getheight 值的想法
【问题讨论】:
-
性别从何而来?
-
对不起,应该是p3.getGender()。我错过了。刚刚编辑。谢谢
标签: c# object parameters nunit