Ejemplo n.º 1
0
        public string Get(string id)
        {
            Task <ApplicationUser> user_by_id = _userGS.GetUserById(id);

            if (user_by_id.Result is null)
            {
                return("Wrong UserId");
            }
            else
            {
                return(user_by_id.Result.Name);
            }
        }
        public async Task <IActionResult> UpdateUser(string UserId, [FromBody] ApplicationUser user)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var getuser = _userGS.GetUserById(UserId);

            if (getuser == null)
            {
                return(NotFound());
            }
            await _userGS.UpdateUser(UserId, user);

            return(Ok("User Updated..."));
        }
        public async Task <bool> Testfor_Validate_GetUserById()
        {
            //Arrange
            bool res = false;

            //Act
            userservice.Setup(repo => repo.GetUserById(_user.UserId)).ReturnsAsync(_user);
            var result = await _userGroceryS.GetUserById(_user.UserId);

            if (result != null)
            {
                res = true;
            }
            //Asert
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_revised.txt", "Testfor_Validate_GetUserById=" + res + "\n");

            return(res);
        }