public Task <Request> Execute(RequestSetting requestSetting) { taskCompletionSource = new System.Threading.Tasks.TaskCompletionSource <Request>(); Status = RequestStatus.Requesting; mClient.Client.Connect(); if (mClient.Client.IsConnected) { try { PipeStream pipeStream = mClient.Client.Stream.ToPipeStream(); Status = RequestStatus.Responding; requestSetting.Write(pipeStream); mClient.Client.Stream.Flush(); } catch (Exception e_) { try { if (mClient.Client != null) { mClient.Client.DisConnect(); } Code = REQUEST_WRITE_ERROR; } finally { OnCompleted(); } } } return(taskCompletionSource.Task); }
public RequestSetting Get(string id) { if (!mRequestCase.TryGetValue(id, out RequestSetting result)) { result = new RequestSetting(); } return(result); }
public bool Modif(RequestSetting requestSetting) { bool result = mRequestCase.ContainsKey(requestSetting.ID); mRequestCase[requestSetting.ID] = requestSetting; Save(); return(result); }
public void Add(RequestSetting requestSetting) { Uri uri = new Uri(Setting.Host); TestRequestSetting item = new TestRequestSetting(); requestSetting.Build(uri.Host, uri.Port); item.RequestSetting = requestSetting; item.Statistics.Name = requestSetting.BaseUrl; Items.Add(item); }
public async Task <Request.TestResult> TestCase(RequestSetting requestSetting, string host) { Uri uri = new Uri(host); using (HttpTcpClient httpTcpClient = new HttpTcpClient(uri.Host, uri.Port)) { requestSetting.Build(uri.Host, httpTcpClient.Port); Request request = new Request(httpTcpClient); var result = await request.Execute(requestSetting); return(request.GetResult()); } }
public bool Save(RequestSetting requestSetting) { return(UseCaseStorage.Default.Modif(requestSetting)); }