Пример #1
0
        public void RefundCalculate()
        {
            //Server URL
            ServerURL s       = new ServerURL();
            string    baseURL = s.CSUrl();
            //Method Name (Resource)
            string transactionID = "1978928";
            string method        = "/api/v1.0/refund/" + transactionID + "/calculate";
            //Complete Request URL
            string requestURL = baseURL + method;
            //Request Body
            string requestObject = "[{ \"DiscId\": 15943220,  \"RefundAmount\": 1, \"Username\": \"RBHQSAKULA-D\"}]";

            //Adding Headers and Creating Request
            var client  = new RestClient(requestURL);
            var request = new RestRequest(Method.POST);

            request.Parameters.Clear();
            request.AddHeader("Origin", baseURL);
            request.AddHeader("Referer", baseURL + "/help/index");
            request.AddParameter("application/json", requestObject, ParameterType.RequestBody);

            //Run Request
            IRestResponse response        = client.Execute(request);
            string        ResponseContent = response.Content;

            //Validate for HTTP - OK in the response and one random element
            Assert.Equal(System.Net.HttpStatusCode.OK, response.StatusCode);
            Assert.Contains("\"Success\":true", ResponseContent);
            Assert.Contains("\"Error\":null", ResponseContent);
            output.WriteLine("RefundCalculate Request: {0}", request);
            output.WriteLine("RefundCalculate Response : {0}", ResponseContent);
        }
Пример #2
0
        public void GetCustomerProfileAccountStatus()
        {
            //Server URL
            ServerURL s       = new ServerURL();
            string    baseURL = s.CSUrl();
            //Method Name (Resource)

            string method = "/Account.svc/status/";
            //Parameter

            string CustomerProfileAccount = "41928298188700";
            //Complete Request URL
            string requestURL = baseURL + method + CustomerProfileAccount;

            var client  = new RestClient(requestURL);
            var request = new RestRequest(Method.GET);

            request.AddHeader("accept", "application/json");

            //Run Request
            IRestResponse response = client.Execute(request);

            string ResponseContent = response.Content;

            //Validate for HTTP - OK in the response and one random element
            Assert.Equal(System.Net.HttpStatusCode.OK, response.StatusCode);
            Assert.Contains("\"WasFound\":true", ResponseContent);
            output.WriteLine("GetCustomerProfileAccountStatus Request: {0}", requestURL);
            output.WriteLine("GetCustomerProfileAccountStatus Response : {0}", ResponseContent);
        }