public void GetListClientUsers_GivenUserAsAdmin_ReturnListWithThreeClientUsers()
        {
            // Arrange
            int processed       = 0;
            var userId          = "810";
            var isAdmin         = true;
            var economicGroupId = 1;

            var listClientUserSpected = ClientUserServiceData.GetListClientUserWithThreeElements();

            clientUserRepository.GetClientsByUserIdAsync(economicGroupId: Arg.Any <int>()).Returns(listClientUserSpected);
            clientUserRepository.When(fx => fx.GetClientsByUserIdAsync(economicGroupId: Arg.Any <int>())).Do(fx => ++ processed);

            // Act
            var clientUserSpectedTask = clientUserService.GetClientsByUserIdAsync(userId, isAdmin, economicGroupId);

            clientUserSpectedTask.Wait();

            // Assert
            Assert.IsTrue(clientUserSpectedTask.Status == TaskStatus.RanToCompletion);
            Assert.IsNotNull(clientUserSpectedTask.Result);
            Assert.AreEqual(3, clientUserSpectedTask.Result.Count);
            Assert.AreEqual(1, processed);
            clientUserRepository.Received(1).GetClientsByUserIdAsync(economicGroupId: Arg.Any <int>());
        }
        public async Task <ActionResult> GetClientsByUserId(int economicGroupId)
        {
            bool   isAdmin = tokenHelper.IsAdmin(User.Claims);
            string userId  = tokenHelper.GetUserId(User.Claims);

            try
            {
                var clientsUser = await clientUserService.GetClientsByUserIdAsync(userId, isAdmin, economicGroupId).ConfigureAwait(false);

                return(new OkObjectResult(clientsUser));
            }
            catch (Exception ex)
            {
                log.Error($"Ocurrió un error al consultar los clientes del usuario: {ex.Message}");
                return(StatusCode(HttpStatusCode.InternalServerError.GetHashCode(), ex.Message));
            }
        }