public void GetUser_Authorized_200()
        {
            var controller  = new UserManagementController();
            var user        = _ut.CreateUserObject();
            var userSession = _ut.CreateSessionObject(user);

            _ut.CreateSessionInDb(userSession);

            var expectedStatusCode = HttpStatusCode.OK;

            var endpoint = API_Route_Local + "/user";

            controller.Request = new HttpRequestMessage
            {
                RequestUri = new Uri(endpoint)
            };
            controller.Request.Headers.Add("token", userSession.Token);

            IHttpActionResult actionresult = controller.GetUser();

            Assert.IsInstanceOfType(actionresult, typeof(NegotiatedContentResult <GetUserResponseData>));
            var contentresult = actionresult as NegotiatedContentResult <GetUserResponseData>;

            Assert.AreEqual(expectedStatusCode, contentresult.StatusCode);
        }
        public void GetUser_GetQuerySuccessfullyExecute_ReturnsOkObjectResult()
        {
            var id   = Guid.NewGuid();
            var user = new UserForDisplay();

            var userManagementServiceMock = new Mock <IUserManagementService>();

            userManagementServiceMock.Setup(x => x.GetUserById(id))
            .Returns(user);
            var userManagementController = new UserManagementController(userManagementServiceMock.Object);

            var claims = new List <Claim>()
            {
                new Claim(ClaimTypes.NameIdentifier, id.ToString())
            };
            var identity        = new ClaimsIdentity(claims);
            var claimsPrincipal = new ClaimsPrincipal(identity);

            var httpContextMock = new Mock <Microsoft.AspNetCore.Http.HttpContext>();

            httpContextMock.Setup(c => c.User).Returns(claimsPrincipal);

            var actionContext = new ActionContext()
            {
                ActionDescriptor = new Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor(),
                RouteData        = new Microsoft.AspNetCore.Routing.RouteData()
            };

            actionContext.HttpContext = httpContextMock.Object;

            var controllerContext = new ControllerContext(actionContext);

            userManagementController.ControllerContext = controllerContext;

            var result = userManagementController.GetUser();

            Assert.IsTrue(result.GetType() == typeof(OkObjectResult));
        }