asp.net mvc - Creating an action based on a mocked controller -
i have following test method being used test controller.
[testmethod()] public void resettest() { var target = new mock<project.reset.controllers.resetcontroller>(); //var target = new project.reset.controllers.resetcontroller(); formcollection form = new formcollection(); form.set("username","domain\\username"); form.set("password","testpass123"); form.set("confirmpassword","testpass123"); viewresult expected = new viewresult(); expected.viewname = "reset"; expected.viewdata.model = rm; actionresult action = target.object.; action = target.object.reset(form); viewresult actual = (viewresult)action; assert.areequal(expected, actual); }
if use the:
var target = new mock<project.reset.controllers.resetcontroller>();
then action being evaluated null. if change line of code below uncommented action being set. ideas might causing behaviour?
why mocking this? seems actual sut (solution under test). so, should not mock @ all.
Comments
Post a Comment