src/SFBulkAPIStarterTest/TestBulkApiClient.cs
/// <summary>
/// Tests upserting an account using the specified ExternalFieldName app setting.
/// </summary>
Tests upserting an account using the specified ExternalFieldName app setting.
Tests upserting an account using the specified ExternalFieldName app setting .
[TestMethod]
        public void UpsertAccountTest()
        {
            String externalFieldName = ConfigurationManager.AppSettings["ExternalFieldName"];
            Assert.AreNotEqual("external_id_here_for_upsert_test", externalFieldName, "Please specify an external id account field.");
            CreateJobRequest jobRequest = buildDefaultUpsertAccountCreateJobRequest(externalFieldName);
            Job job = _apiClient.CreateJob(jobRequest);
            String batchContents = buildDefaultAccountBatchContents();
            CreateBatchRequest batchRequest = buildCreateBatchRequest(job.Id, batchContents);
            Batch accountBatch = _apiClient.CreateBatch(batchRequest);
            _apiClient.CloseJob(job.Id);
            job = _apiClient.GetCompletedJob(job.Id);
            Assert.IsTrue(job.NumberBatchesFailed == 0);
            Assert.IsTrue(job.NumberRecordsProcessed > 0);
        }
[ TestMethod ] public void UpsertAccountTest ( ) { String externalFieldName = ConfigurationManager . AppSettings [ " " ] ; Assert . AreNotEqual ( " " , externalFieldName , " " ) ; CreateJobRequest jobRequest = buildDefaultUpsertAccountCreateJobRequest ( externalFieldName ) ; Job job = _apiClient . CreateJob ( jobRequest ) ; String batchContents = buildDefaultAccountBatchContents ( ) ; CreateBatchRequest batchRequest = buildCreateBatchRequest ( job . Id , batchContents ) ; Batch accountBatch = _apiClient . CreateBatch ( batchRequest ) ; _apiClient . CloseJob ( job . Id ) ; job = _apiClient . GetCompletedJob ( job . Id ) ; Assert . IsTrue ( job . NumberBatchesFailed == 0 ) ; Assert . IsTrue ( job . NumberRecordsProcessed > 0 ) ; }
Tests upserting an account using the specified ExternalFieldName app setting.
Tests upserting an account using the specified ExternalFieldName app setting .
// Upsert an account // Close job so no more batches are added.