This project is read-only.
1
Vote

Do: Create unit test cases

description

I have created the unit test case for Register() method in AccountController.
Scenarios:
1) Valid data passed and user created successfully - redirected to Home/Index (expected)
2) Valid data passed and user creation failed - model state invalid (expected)
 
I made one change to ValidateRegistration(). The method signature now is: protected virtual bool ValidateRegistration(...)
It is advisable to use protected virtual instead of private methods so that the method qualifies for stub/mocks using frameworks.
 
Please see the file attachment for more details. I will keep adding the test cases as an when I will write them. Ideally targeting for 100% code coverage hence every single line of code (in all the methods) should be testable by isolating their dependencies.

file attachments

comments