Beispiel #1
0
        public void GetEmployeeDetailsTest()
        {
            int badgeNumber = 93467;

            var response = travelRequestService.GetEmployeeDetails(badgeNumber);

            Assert.IsNotNull(response);
        }
Beispiel #2
0
        public HttpResponseMessage GetEmployeeDetails(int badgeNumber)
        {
            HttpResponseMessage response = null;

            try
            {
                var result = travelRequestService.GetEmployeeDetails(badgeNumber).Result;
                var data   = new JavaScriptSerializer().Serialize(result);

                response = Request.CreateResponse(HttpStatusCode.OK, data);
            }
            catch (Exception ex)
            {
                LogMessage.Log("GetEmployeeDetails :" + ex.Message);
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, string.Format(@"The badge# {0} you have entered is invalid. Please try again.", badgeNumber));
            }
            return(response);
        }