Beispiel #1
0
        public async Task LoadAllUsers_Success()
        {
            // Arrange
            var request = LoadAllUsersMediatorCommand.CreateCommand();
            var users   = _readUsersBuilder.Build();

            A.CallTo(() => _repository.LoadUsersAsync(default)).Returns(users);
Beispiel #2
0
        public async Task <IActionResult> GetUsers(CancellationToken cancellationToken)
        {
            try
            {
                var scope            = _mediatorFactory.CreateScope();
                var mediatorResponse = await scope.SendAsync(LoadAllUsersMediatorCommand.CreateCommand(), cancellationToken);

                var response = LoadAllUsers.Response.Create(mediatorResponse.Users);

                return(new OkObjectResult(response));
            }
            catch (Exception ex)
            {
                return(new BadRequestObjectResult(ex.Message));
            }
        }