public async Task TestUpdate() { // Create IdName newAccountIdName = await CreateAccount(); // Update string updatedAccountName = generateAccountName(); var fields = new Dictionary <string, object> { { "name", updatedAccountName } }; RestResponse updateResponse = await _restClient.SendAsync(RestRequest.GetRequestForUpdate(TestCredentials.API_VERSION, "account", newAccountIdName.Id, fields)); Assert.IsTrue(updateResponse.Success, "Update failed"); // Retrieve - expect updated name RestResponse response = await _restClient.SendAsync(RestRequest.GetRequestForRetrieve(TestCredentials.API_VERSION, "account", newAccountIdName.Id, new[] { "name" })); Assert.AreEqual(updatedAccountName, response.AsJObject["Name"], "Wrong row returned"); }
public void TestGetRequestForUpdate() { RestRequest request = RestRequest.GetRequestForUpdate(TEST_API_VERSION, TEST_OBJECT_TYPE, TEST_OBJECT_ID, TEST_FIELDS); Assert.AreEqual(RestMethod.PATCH, request.Method, "Wrong method"); Assert.AreEqual(ContentType.JSON, request.ContentType, "Wrong content type"); Assert.AreEqual("/services/data/" + TEST_API_VERSION + "/sobjects/" + TEST_OBJECT_TYPE + "/" + TEST_OBJECT_ID, request.Path, "Wrong path"); Assert.AreEqual(TEST_FIELDS_string, request.Body, "Wrong request body"); Assert.IsNull(request.AdditionalHeaders, "Wrong additional headers"); }