コード例 #1
0
        public async Task PostTestCase()
        {
            await Task.Run(() =>
            {
                try
                {
                    RequestModel model = new RequestModel();
                    model.endPoint     = baseURL + "create";
                    model.contentType  = "application/json";
                    model.method       = "POST";

                    #region PostData
                    Data createData   = new Data();
                    createData.age    = "22";
                    createData.name   = "Testing";
                    createData.salary = "1000";
                    #endregion

                    #region Data Serialization
                    var data      = JsonConvert.SerializeObject(createData);
                    model.content = data;
                    #endregion

                    var response = WebAPICall.GetRequest(model).GetResponse() as HttpWebResponse;
                    CreateResponseModel Result = JsonConvert.DeserializeObject <CreateResponseModel>(WebAPICall.UnPack(response));
                    Assert.AreEqual("success", Result.status);
                }
                catch
                {
                    Assert.IsTrue(false);
                }
            });
        }
コード例 #2
0
 public async Task GetTestCase()
 {
     await Task.Run(() =>
     {
         try
         {
             RequestModel model   = new RequestModel();
             model.endPoint       = baseURL + "employees";
             model.contentType    = "application/json";
             model.method         = "GET";
             var response         = WebAPICall.GetRequest(model).GetResponse() as HttpWebResponse;
             EmployeeModel Result = JsonConvert.DeserializeObject <EmployeeModel>(WebAPICall.UnPack(response));
             Assert.AreEqual("success", Result.status);
         }
         catch
         {
             Assert.IsTrue(false);
         }
     });
 }