I'm currently looking for unit testing to create a new application. I have a basic test running well (testing the ActionResult classes is great) One thing I want to make sure, however, is that there is a view page in my solution. I am not 100% sure that my test is correct, so if any suggestions are given to you, do not hesitate!
This is an inquiry I have to see that my login method is true on my security controller:
[TestMethod] public zero login () {var authProvider = new fake & Lt; IAuthenticationProvider & gt; (); Var controller = new security controller (authProvider.Object); Var Results = Controller Login () as viewResult; Confirm. No No (Results, "Action should be of consequence type."); Relax. First (result. View, "login", "login page does not provide."); }
My explanation of the test will be:
- Call the 'Login' method on the controller
- Confirm that it is a
- Confirm presenting this right view (by checking the name)
What do I want is that one third
- Should I separate this exam?
- I should change the name of (eg, mistake, loginrescreenscontact view or something)
Thanks!
Note: I am trying to avoid checking clearly the file system is expecting a way of using ViewEngine to confirm the scene I actually exist.
-
No, I do not think you should separate the test unless It mainly has a third emphasis and not too much code.
-
Yes, I think a more descriptive name would be helpful.
-
Since you have verified that its correct visual name is already, will not this view be successfully verified for its existence?
I think its great you are working on full test coverage but here I feel that your time may be more effective if you are ahead in the part Were able to grow where you verify that the units that are working correctly are actual specific login functions (such as password hash or whatever verification).
Comments
Post a Comment