public async Task TestSparkBatchJob() { // Submit the Spark job SparkBatchJobOptions createParams = this.CreateSparkJobRequestParameters(); SparkBatchJob jobCreateResponse = (await SparkBatchClient.CreateSparkBatchJobAsync(createParams)).Value; // Poll the Spark job until it finishes SparkBatchJob getJobResponse = await this.PollSparkBatchJobSubmissionAsync(jobCreateResponse); // Verify the Spark batch job completes successfully Assert.True("success".Equals(getJobResponse.State, StringComparison.OrdinalIgnoreCase) && getJobResponse.Result == SparkBatchJobResultType.Succeeded, string.Format( "Job: {0} did not return success. Current job state: {1}. Actual result: {2}. Error (if any): {3}", getJobResponse.Id, getJobResponse.State, getJobResponse.Result, string.Join(", ", getJobResponse.Errors ?? new List <SparkServiceError>()) ) ); // Get the list of Spark batch jobs and check that the submitted job exists List <SparkBatchJob> listJobResponse = await this.ListSparkBatchJobsAsync(); Assert.NotNull(listJobResponse); Assert.IsTrue(listJobResponse.Any(job => job.Id == getJobResponse.Id)); }