.net unit testing 中 assert.equal 不支持自定义的类么??永远返回false???
怎么办啊?
怎么办啊?
解决方案 »
- 想用C#做一个特别简单的找茬游戏,求指导
- 哪种设置背景图的方法比较好
- 谁有把csv文件读区到DataTable了的代码~
- 请问如何利用存储过程获取url传值
- 很难。高手帮忙!通过url抓取网页内容保存到本地服务器,供客户访问,且同步更新
- 关于C#调用C++函数绑定回调函数后发生CrossThreadMessagingException异常的问题
- 高分求教:如何在使用Remoting 时在服务器端得到客户端的Ip或Mac,分不够再加
- panel1.DrawToBitmap 截取panel 下半部分图片的问题
- c#for无限循环
- 在程序里怎么设定文本的颜色
- 我用vs2005做了个服务,但是怎么注册这个服务啊?
- 请高手帮忙啊,列名 'Xinwenneirong1' 无效
但是在工程中并不需要给每个复杂类都重写equal方法阿,那样不要死人的阿?所以如果是这样的话,unit testing还有啥必要啊?最简单的代码,随便生成一个uint testing 模块,然后里面 [TestMethod()]
public void addTest()
{
//TestClass1 target = new TestClass1(); //int a = 0; // TODO: Initialize to an appropriate value //int b = 0; // TODO: Initialize to an appropriate value //int expected = 0;
//int actual = 0; //actual = target.add(a, b); TestClass1 expected = new TestClass1();
TestClass1 actual = new TestClass1();
Assert.AreEqual(expected, actual, "ConsoleApplication.TestClass1.add did not return the expected value.");
//Assert.Inconclusive("Verify the correctness of this test method.");
}这样永远是false. 但是如果用VS内置的类就返回true。 难道Assert.AreEqual不支持递归判断相等么?唉...那样不是太弱了阿
asssert就是值的比较,如果你要比较两个对象的话,需要重载了