大佬教程收集整理的这篇文章主要介绍了c# – 如何测试方法(白盒测试),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
private static void SELEctTop20Tags(Dictionary<String,int> list) { //Outputs the top 20 most common hashtags in descending order foreach (KeyValuePair<String,int> pair in list.orderByDescending(key => key.value).Take(20)) { Console.WriteLine("{0},{1}",pair.Key,pair.value); } }
我不知道我将如何测试这一点,我一直在研究它并尝试各种各样的东西,但无法让它工作.
#if TEST if ((length of list don't kNow how you would do it) <= 20) { StreamWriter log2; // appends file log2 = File.AppendText("logofTests.txt"); // Writes to the file log2.WriteLine("PASS"); log2.WriteLine(); // Closes the stream log2.Close(); } #endif
我想我只需要看一个例子,我就会知道.
我还建议分离出与UI相关的代码,例如对messageBox的调用,其他UI元素和Console;来自您要测试的代码.这将使测试代码的逻辑和执行变得更加容易.
以上是大佬教程为你收集整理的c# – 如何测试方法(白盒测试)全部内容,希望文章能够帮你解决c# – 如何测试方法(白盒测试)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。