public void RestorePasswordShouldCallResetPassword(FakeMembershipUser user, MembershipProvider membershipProvider, AccountRepository repo) { user.ProviderName.Returns("fake"); membershipProvider.ResetPassword(Arg.Any<string>(), Arg.Any<string>()).Returns("new password"); membershipProvider.Name.Returns("name"); membershipProvider.GetUser(Arg.Any<string>(), Arg.Any<bool>()).Returns(user); using (new MembershipSwitcher(membershipProvider)) { repo.RestorePassword(@"extranet\John"); membershipProvider.Received(1).ResetPassword(Arg.Any<string>(), Arg.Any<string>()); } }
public void RegisterShouldCreateUserWithEmailAndPassword(FakeMembershipUser user, MembershipProvider membershipProvider, RegistrationInfo registrationInfo, string userProfile, AccountRepository repository) { user.ProviderName.Returns("fake"); user.UserName.Returns("name"); MembershipCreateStatus status; membershipProvider.CreateUser(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>(), Arg.Any<object>(), out status).Returns(user); membershipProvider.GetUser(Arg.Any<string>(), Arg.Any<bool>()).Returns(user); using (new Switcher<Domain, Domain>(new Domain("somedomain"))) { using (new MembershipSwitcher(membershipProvider)) { repository.RegisterUser(registrationInfo.Email,registrationInfo.Password, userProfile); membershipProvider.Received(1).CreateUser($@"somedomain\{registrationInfo.Email}", registrationInfo.Password, Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>(), Arg.Any<bool>(), Arg.Any<object>(), out status); } } }