Testing an object's state at save

Ytiruces

New Member
I'm looking to write unit tests for a method such as this one:\[code\]public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer){ ISPMembershipUserDao userDao = GetISPMembershipUserDao(); if (ValidateUser(username, password)) { SPMembershipUser user = userDao.GetUserByUserName(username); user.PasswordQuestion = newPasswordQuestion; user.PasswordAnswer = newPasswordAnswer; userDao.Save(user); return true; } return false;}\[/code\]It's a fairly straight-forward method to test. I'm using the Rhino Mocks framework. But one aspect has me questioning myself. I stub the DAO object and its save method, and I'm wondering how deeply I should test that user object that is passed to the save method. Should I assert that every property of that object is as I expect it to be? Or should I only assert that the PasswordQuestion and PasswordAnswer properites have the correct values? The former seems right to me, as I should make sure that only those two properties have been modified, and the others haven't been touched.I was hoping some people could give their opinions on this. Is there a rule of thumb or pattern to keep in mind for these types of situations?
 
Back
Top