Hi
I am having problems with moq again and not sure what I did wrong this time.
So I am going through the debugger step by step and I notice even though in my Mock I set
ResetPassword to return "hey it does not seem to
Here is part of my unit test:
var membershipMock = new Mock<MembershipProvider>();
var user = new Mock<MembershipUser>();
user.SetupGet(x => x.Email).Returns("Email");
user.Setup(x => x.ResetPassword("test")).Returns("hey");
membershipMock.Setup(m => m.GetUser("chobo2", false)).Returns(user.Object);
authentication.Authenticate.Provider = membershipMock.Object;
// Act
var actual = authentication.PasswordRecoveryStep2("chobo2","2z");
My code
MembershipUser userName = Provider.GetUser(user, false);
string newPassword = userName.ResetPassword(securityAnswer);
Mail.To = userName.Email;
Provider is a property that gets set with the mockup object as you and see. The email part gets filled fine. Just ResetPassword does not return what it should. It just give me null.
Thanks