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); }
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); } }
public async Task <ActionResult> SetRole([FromBody] SetRoleDto setRoleDto) { await _authService.SetRoleAsync(setRoleDto); return(NoContent()); }