Exemplo n.º 1
0
 public void PostInValidDeleteRequestToService(string customerUid, string actionUtc, string contentType, HttpStatusCode actualResponse)
 {
     try
     {
         string accessToken = CustomerServiceConfig.GetValidUserAccessToken();
         LogResult.Report(Log, "log_ForInfo", "Posting the request with Valid Values: " + customerUid);
         ResponseString = RestClientUtil.DoInvalidHttpRequest(string.Format("{0}?CustomerUID={1}&ActionUTC={2}", CustomerServiceConfig.CustomerServiceEndpoint, customerUid, actionUtc),
                                                              HeaderSettings.DeleteMethod, accessToken,
                                                              contentType, null, actualResponse, HeaderSettings.BearerType, HeaderSettings.JsonMediaType);
     }
     catch (Exception e)
     {
         LogResult.Report(Log, "log_ForError", "Got Error While Posting Data To Customer Service", e);
         throw new Exception(e + " Got Error While Posting Data To Customer Service");
     }
 }
Exemplo n.º 2
0
        public void PostValidUpdateRequestToService()
        {
            string requestString = JsonConvert.SerializeObject(UpdateCustomerModel);

            try
            {
                string accessToken = CustomerServiceConfig.GetValidUserAccessToken();
                LogResult.Report(Log, "log_ForInfo", "Posting the request with Valid Values: " + requestString);
                ResponseString = RestClientUtil.DoHttpRequest(CustomerServiceConfig.CustomerServiceEndpoint, HeaderSettings.PutMethod, accessToken,
                                                              HeaderSettings.JsonMediaType, requestString, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType);
            }
            catch (Exception e)
            {
                LogResult.Report(Log, "log_ForError", "Got Error While Posting Data To Customer Service", e);
                throw new Exception(e + " Got Error While Posting Data To Customer Service");
            }
        }
Exemplo n.º 3
0
        public void PostInValidCustomerAssetAssociateRequestToService(string contentType, HttpStatusCode actualResponse)
        {
            string requestString = JsonConvert.SerializeObject(InvalidAssociateCustomerAssetModel);

            try
            {
                string accessToken = CustomerServiceConfig.GetValidUserAccessToken();
                LogResult.Report(Log, "log_ForInfo", "Posting the request with Valid Values: " + requestString);
                ResponseString = RestClientUtil.DoInvalidHttpRequest(CustomerServiceConfig.CustomerServiceEndpoint + "/AssociateCustomerAsset", HeaderSettings.PostMethod, accessToken,
                                                                     contentType, requestString, actualResponse, HeaderSettings.BearerType, HeaderSettings.JsonMediaType);
            }
            catch (Exception e)
            {
                LogResult.Report(Log, "log_ForError", "Got Error While Posting Data To customer Service", e);
                throw new Exception(e + " Got Error While Posting Data To customer Service");
            }
        }
Exemplo n.º 4
0
        public void PostValidDeleteRequestToService(Guid customerUid, DateTime actionUtc)
        {
            string actionUtcString = actionUtc.ToString("yyyy-MM-ddThh:mm:ss");
            string customerUID     = customerUid.ToString();

            try
            {
                string accessToken = CustomerServiceConfig.GetValidUserAccessToken();
                LogResult.Report(Log, "log_ForInfo", "Posting the request with Valid Values: " + customerUID);
                ResponseString = RestClientUtil.DoHttpRequest(string.Format("{0}?CustomerUID={1}&ActionUTC={2}", CustomerServiceConfig.CustomerServiceEndpoint, customerUID, actionUtcString),
                                                              HeaderSettings.DeleteMethod, accessToken,
                                                              HeaderSettings.JsonMediaType, null, HttpStatusCode.OK, HeaderSettings.BearerType, HeaderSettings.JsonMediaType);
            }
            catch (Exception e)
            {
                LogResult.Report(Log, "log_ForError", "Got Error While Posting Data To Customer Service", e);
                throw new Exception(e + " Got Error While Posting Data To Customer Service");
            }
        }