问题描述
如何写于2008年VS单元测试方法?
- 在用户名和密码提交,我称这是.aspx.cs file.I需要编写单元测试用于以.aspx.cs文件中定义的方法的方法。
- 从.aspx.cs文件,我已要求这是在单独的文件的方法。
- 所以我需要支付code这是.aspx.cs文件以及在cs文件。
所以我的问题是,我们可以编写测试方法.aspx.cs文件?
How to write unit test methods for VS 2008?- On Submission of User Name and Password, i have called the method which is .aspx.cs file.I need to write the unit test for the methods which are defined in .aspx.cs file.-From .aspx.cs file, i have called the methods which is in separate file.- So i need to cover the code which is in .aspx.cs file and also in .cs file.So my question is, can we write test methods .aspx.cs file?
推荐答案
我想借此要测试code,并将其移动到一个单独的类。这听起来像这种方法在一个类是负责验证用户所属。那么你的aspx.cs文件可以使用这个类来验证用户。
I would take the code which you want to test, and move it to a seperate class. It sounds like this method belongs in a class which is responsible for validating users. Then your aspx.cs file can use this class to validate users.
如果你真的想这样做,那么这可能会帮助你:
http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/5c984f7f-31c9-48ef-b8e5-c9c8357431ae
If you really want to do it, then this might help you:http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/5c984f7f-31c9-48ef-b8e5-c9c8357431ae
这篇关于如何写aspx.cs文件的单元测试方法在VS 2008中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!