예제 #1
0
        public IHttpActionResult GetLastModification(Module module)
        {
            GetLastModificationResponse response = new GetLastModificationResponse();

            try
            {
                List <LastModification> lastModifications = new List <LastModification>();
                LastModification        lastModification  = lastModificationBL.GetLastModification(module);
                lastModifications.Add(lastModification);
                response.LastModifications = lastModifications;
                response.Success           = true;
            }
            catch (Exception ex)
            {
                response.ErrorMessage = "Error. " + ex.Message;
                response.Success      = false;
            }
            return(Ok(response));
        }
예제 #2
0
        public void TestGetWeightTicketsProducts()
        {
            //insert dummy data
            InsertDummyData();
            //Get token
            Token token = TokenHelper.GetToken(baseUrl, "Melvin3", "MelvinPass3");
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            //Post add ticket
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri(baseUrl);
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.access_token);
            string url = string.Format("{0}?module={1}", getLastModification, 1); //Producers
            HttpResponseMessage response = client.GetAsync(url).Result;

            Assert.IsTrue(response.IsSuccessStatusCode);
            GetLastModificationResponse getLastModificationResponse = response.Content.ReadAsAsync <GetLastModificationResponse>().Result;

            Assert.IsTrue(getLastModificationResponse.Success);
            Assert.IsTrue(getLastModificationResponse.LastModifications.Count > 0);
        }