コード例 #1
0
 internal override void Execute()
 {
     var cmdlet = (SendTmxCommonDataItemCommand)Cmdlet;
     var keyValuePair = new CommonDataItem { Key = cmdlet.Key, Value = cmdlet.Value };
     var commonDataSender = new CommonDataSender(new RestRequestCreator());
     try {
         commonDataSender.Send(keyValuePair);
         cmdlet.WriteObject(true);
     }
     catch (SendingCommonDataItemException e) {
         // throw new Exception("Failed to send data with key '" + cmdlet.Key + "'. " + e.Message);
         throw;
     }
 }
コード例 #2
0
 public void Should_respond_Created_on_new_common_data_upload_as_json()
 {
     const string expectedKey = "aaa";
     const string expectedValue = "bbb";
     var url = GIVEN_url_to_testRun_data();
     _responseHeaders.Location = new Uri(BaseUrl + url);
     _mockRestServer.ExpectNewRequest()
         .AndExpectUri(BaseUrl + url)
         .AndExpectMethod(HttpMethod.POST)
         .AndExpectBodyContains(expectedKey)
         .AndExpectBodyContains(expectedValue)
         .AndRespondWith("", _responseHeaders, HttpStatusCode.Created, "");
     
     var commonDataSender = new CommonDataSender(_restRequestCreator);
     commonDataSender.Send(new CommonDataItem { Key = expectedKey, Value = expectedValue });
 }