public RegisterUser ( string email, string password, string profileId ) : void | ||
string | ||
password | string | |
profileId | string | |
리턴 | void |
public void RegisterShouldCreateLoginUser(FakeMembershipUser user, [Substitute] MembershipProvider membershipProvider, [Substitute] AuthenticationProvider authenticationProvider, RegistrationInfo registrationInfo, AccountRepository repository, string profileId) { 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)) { using (new AuthenticationSwitcher(authenticationProvider)) { repository.RegisterUser(registrationInfo.Email, registrationInfo.Password, profileId); authenticationProvider.Received(1).Login(Arg.Is<string>(u => u == $@"somedomain\{registrationInfo.Email}"), Arg.Is<string>(p=>p== registrationInfo.Password), Arg.Any<bool>()); } } } }
public void Register_ValidUser_ShouldTrackRegistraionEvents(FakeMembershipUser user, [Substitute]MembershipProvider membershipProvider, [Substitute]AuthenticationProvider authenticationProvider, RegistrationInfo registrationInfo, [Frozen]IAccountTrackerService accountTrackerService, AccountRepository repository, string profileId) { 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)) { using (new AuthenticationSwitcher(authenticationProvider)) { repository.RegisterUser(registrationInfo.Email, registrationInfo.Password, profileId); accountTrackerService.Received(1).TrackRegistration(); } } } }
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); } } }