public async Task GetUser_Success_GetUserHimself()
        {
            //Arrange------------------------------------------------------------------------------------------------------------------------------
            var users = UsersControllerData.GetUser();
            var userForDetailedDto = UsersControllerData.GetUserForDetailedDto();

            _mockRepo.Setup(x => x._UserRepository
                            .GetAllAsync(
                                It.IsAny <Expression <Func <User, bool> > >(),
                                It.IsAny <Func <IQueryable <User>, IOrderedQueryable <User> > >(),
                                It.IsAny <string>())).ReturnsAsync(() => users);
            //
            _mockMapper.Setup(x => x.Map <UserProfileDto>(It.IsAny <User>()))
            .Returns(userForDetailedDto);


            //Act----------------------------------------------------------------------------------------------------------------------------------
            var result = await _controller.GetUsers(It.IsAny <string>());

            var okResult = result as OkObjectResult;

            //Assert-------------------------------------------------------------------------------------------------------------------------------
            Assert.NotNull(okResult);
            Assert.IsType <UserProfileDto>(okResult.Value);
            Assert.Equal(200, okResult.StatusCode);
        }
        public async Task UpdateUser_Success_UpdateUserHimself()
        {
            //Arrange------------------------------------------------------------------------------------------------------------------------------
            var users = UsersControllerData.GetUser();

            //var userForDetailedDto = UsersControllerMockData.GetUserForDetailedDto();
            _mockRepo.Setup(x => x._UserRepository
                            .GetByIdAsync(
                                It.IsAny <string>())).ReturnsAsync(() => users.First());

            _mockRepo.Setup(x => x._UserRepository
                            .Update(
                                It.IsAny <User>()));

            _mockRepo.Setup(x => x.SaveAcync()).ReturnsAsync(1);
            //
            _mockMapper.Setup(x => x.Map(It.IsAny <UserForUpdateDto>(), It.IsAny <User>()))
            .Returns(users.First());

            //Act----------------------------------------------------------------------------------------------------------------------------------

            var result = await _controller.UpdateUser(It.IsAny <string>(), It.IsAny <UserForUpdateDto>());

            var okResult = result as NoContentResult;

            //Assert-------------------------------------------------------------------------------------------------------------------------------

            Assert.NotNull(okResult);
            Assert.Equal(204, okResult.StatusCode);
        }
        public async Task UpdateUser_Fail_UpdateAnOtherUser()
        {
            //Arrange------------------------------------------------------------------------------------------------------------------------------
            var users = UsersControllerData.GetUser();

            //var userForDetailedDto = UsersControllerMockData.GetUserForDetailedDto();
            _mockRepo.Setup(x => x._UserRepository
                            .GetByIdAsync(
                                It.IsAny <string>())).ReturnsAsync(() => users.First());

            _mockRepo.Setup(x => x._UserRepository
                            .Update(
                                It.IsAny <User>()));

            _mockRepo.Setup(x => x.SaveAcync()).ReturnsAsync(0);
            //
            _mockMapper.Setup(x => x.Map(It.IsAny <UserForUpdateDto>(), It.IsAny <User>()))
            .Returns(users.First());
            //

            //Act----------------------------------------------------------------------------------------------------------------------------------
            var result = await _controller.UpdateUser(It.IsAny <string>(), UsersControllerData.userForUpdateDto_Fail);

            var badResult = result as BadRequestObjectResult;

            //Assert-------------------------------------------------------------------------------------------------------------------------------

            Assert.NotNull(badResult);
            Assert.IsType <ReturnMessage>(badResult.Value);
            Assert.Equal(400, badResult.StatusCode);
        }