Exemplo n.º 1
0
        public void Should_Map_SendActivationInfo_Command()
        {
            // Arrange
            var dto = new SetRoleDto
            {
                Username  = UserTestSeedData.Performer.UserName,
                RoleNames = new[] { RoleNames.Staff }
            };

            // Act
            SendActivationInfo.Command command = _mapper.Map <SendActivationInfo.Command>(dto);

            // Assert
            command.Username.Should().BeEquivalentTo(dto.Username);
        }
Exemplo n.º 2
0
        public async Task SetRoleAsync(SetRoleDto setRoleDto)
        {
            SetRole.Command command   = _mapper.Map <SetRole.Command>(setRoleDto);
            var             isNewUser = await _mediator.Send(command);

            if (isNewUser)
            {
                SendActivationInfo.Command activationCommand = _mapper.Map <SendActivationInfo.Command>(setRoleDto);
                await _mediator.Send(activationCommand);
            }

            if (setRoleDto.RoleNames.Contains(RoleNames.Performer))
            {
                SendQRCode.Command codeCommand = _mapper.Map <SendQRCode.Command>(setRoleDto);
                await _mediator.Send(codeCommand);
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult> SetRole([FromBody] SetRoleDto setRoleDto)
        {
            await _authService.SetRoleAsync(setRoleDto);

            return(NoContent());
        }