1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Utils;
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Collections.Specialized;
- using Newtonsoft.Json;
- namespace Utils.Tests
- {
- [TestClass()]
- public class WebClientHelperTests
- {
- [TestMethod()]
- public void ClientPostTest()
- {
- var thisDate = DateTime.Now;
- var date = thisDate.ToString("yyyy年MM月dd日");
- var closingDate = "2021年05月至2021年06月";
- var type = "1";
- var phone = "13488868166";
- var outingDate = "2021年07月12日";
- string url = AppSettingsHelper.Configuration["kunshanUrl"];
- var postvalues = new NameValueCollection();
- postvalues.Add("telephone", phone);
- postvalues.Add("type", type);
- postvalues.Add("closingDate", closingDate);
- postvalues.Add("outingDate", outingDate);
- var res = WebClientHelper.ClientPost(url, postvalues);
- var outData=JsonConvert.DeserializeObject<OutData>(res);
- Assert.Fail();
- }
- }
- public class OutData
- {
- public string status { get; set; }
- public string msg { get; set; }
- public string contents { get; set; }
- }
- }
|