First, as a result of the development of the patch function has not encountered any technical problems, here only paste the relevant code:
<summary>
Labeling designated parking spaces
</summary>
<param name= "Parkinginfo" > will carry out the parking information of the stickers </param>
Public Postresult Postonecar (Parkinginfo parkinginfo)
{
No parking on the parking lot
if (ParkingInfo.CarId.Equals ("0"))
{
return null;
}
Parking margin not enough to stick
if (!string. IsNullOrEmpty (Parkinginfo.carprofit) && Convert.ToInt32 (parkinginfo.carprofit) <= 150)
{
return null;
}
String posturl = "http://www.kaixin001.com/parking/post.php";
String postparams = String. Format ("_=&acc={0}&parkid={1}&verify={2}", ACC, Parkinginfo.parkid, verify);
String Postresultjson = new Httphelper (). Gethtml (PostURL, Postparams, True, utility.cookies);
if (string. IsNullOrEmpty (Postresultjson))
{
return null;
}
Object o = Newtonsoft.Json.JavaScriptConvert.DeserializeObject (Postresultjson.replace ("\\/", "/"). Replace ("\\u", "\\\\u"));
return new Postresult (O);
}
Here is the test code:
<summary>
Postonecar Test (for the first n parking spaces for the patch operation)
</summary>
[TestMethod ()]
public void Postonecartest ()
{
string loginemail = Unittesthelper.loginemail;
string loginpassword = Unittesthelper.loginpassword;
Utility.login (Loginemail, Loginpassword);
Parkinghelper helper = new Parkinghelper ();
Helper. Getparkerdetails ();
Postresult result = Helper. Postonecar (helper. PARKINGLIST[3]); Make a patch operation on the nth parking space
Assert.areequal<string> ("0", result. ErrNo);
Console.WriteLine (Result. ERROR);
}