예제 #1
0
        public async Task Should_Send_Activation_Info()
        {
            var command = new SendActivationInfo.Command
            {
                Username = UserTestSeedData.Performer.UserName
            };

            // Act
            Unit result = await _handler.Handle(command, new CancellationToken());

            // Assert
            result.Should().BeEquivalentTo(Unit.Value);
        }
예제 #2
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);
        }
예제 #3
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);
            }
        }