예제 #1
0
        public void ThrowWhenNotPassingRegisteredUserRole()
        {
            var authUser  = AuthUserTestHelper.User().WithRoles(PendingRole).Build();
            var wrongRole = PendingRole;

            Action registration = () => _userRegistrationService.Register(authUser, wrongRole, PendingRole);

            registration.Should().Throw <ArgumentException>();
        }
        public AuthUser FinishRegistration(UserId id)
        {
            return(_unitOfWork.WithAuthUserTransaction(tran => {
                var registeredUserRole = _roleRepository.Find(new RolenameSpecification(Role.REGISTERED_USER_ROLENAME));
                var pendingRegistrationRole = _roleRepository.Find(new RolenameSpecification(Role.PENDING_REGISTRATION_ROLENAME));
                var authUser = _authUserRepository.FindById(id);

                _userRegistrationDomainService.Register(authUser, registeredUserRole, pendingRegistrationRole);

                _authUserRepository.Save(authUser);

                return tran.CommitWith(authUser);
            }));
        }