public void CookieController_Get_ById_Success() { //arrange int id = 2; //act string result = _controller.Get(id); //assert Assert.AreEqual("Oreo", result); }
/// <summary> /// A helper function that calls a Web API endPoint with the HttpMethod.Get method, wraped with the endPoint Athentication Token. /// </summary> /// <param name="uri">The Apie Endpoint to call</param> /// <returns>The responce object from the controller, No error checking is performed on this call.</returns> public virtual async Task <HttpResponseMessage> ApiGet(string uri) { try { var client = _httpClientFactory.CreateClient("TGSClient"); string token = _httpContextCookieController.Get("token"); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); client.DefaultRequestHeaders.Add("user", _httpContextCookieController.Get("user")); var response = await client.GetAsync(uri); return(response); } catch (Exception ex) { throw; } }