class Sample
{
private List<String> names; private List<String> GetNames()
{
return new List<string>();
} private void DoWork()
{
//Actual do work
} protected void Execute()
{
names = GetNames(); if (names.Count > 0)
{
DoWork();
}
}
}
请问上面的这个类的Execute需要测试吗?
顺便问一下有什么网站可以有单元测试的入门?主要是思想方面的,谢谢
{
names = GetNames(); //if (names.Count > 0)
//{
// DoWork();
//}
DoWork();
}
if condition1
execute method1
else if condition2
execute method2
else if ...
假如要检验method1是不是被调用过非常麻烦,那么这方法测起来岂不很麻烦?