我有一个类“patientinfo”,其中包括变量,例如名字,姓氏,年龄,体重,身高,性别....这些变量中的每一个都有get和set方法。 另一类“程序具有以下的方法使用对象作为参数进行Nunit测试
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的制备测试情况下这种方法。正如我ま基本学习者,期望关于如何通过在测试类高度或的getHeight的值的观点请
性别从哪里来? – TGH
对不起,应该是p3.getGender()。我错过了。刚刚编辑。谢谢 – userabc55478