How can i write unit test for Gridview_RowCommand event?
I think question is itself explanatory. I am wondering how it is possible to write NUnit tests for 开发者_JAVA技巧such events. If you go deeper, it looks like using ASP.NET is not appropriate for writing unit tests.
Thoughts please ..
Edit The idea of this question is, if you have a grid view in your page and let's say you have gridview.rowcommand event subscribed on this control. And, you have some logic that is implemented based on the rowcommand event arguments. Now, how will you test this method using a unit testing framework?
What are you trying to test? Do you want to test the logic inside GridView.RowCommand
, or something else?
You can do this; wrap any logic inside the GridView.RowCommand
inside a method, and test that method instead of the event.
If you absolutely positively must test the ASP.Net event, then you may need Ivonna, a Typemock add-on. But I have to warn you that it's not free
精彩评论