public async stt::Task UpdateJobRequestObjectAsync()
        {
            moq::Mock <JobController.JobControllerClient> mockGrpcClient = new moq::Mock <JobController.JobControllerClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            UpdateJobRequest request = new UpdateJobRequest
            {
                ProjectId  = "project_id43ad98b0",
                Region     = "regionedb20d96",
                JobId      = "job_id38ea97d6",
                Job        = new Job(),
                UpdateMask = new wkt::FieldMask(),
            };
            Job expectedResponse = new Job
            {
                Reference        = new JobReference(),
                Placement        = new JobPlacement(),
                HadoopJob        = new HadoopJob(),
                SparkJob         = new SparkJob(),
                PysparkJob       = new PySparkJob(),
                HiveJob          = new HiveJob(),
                PigJob           = new PigJob(),
                Status           = new JobStatus(),
                YarnApplications =
                {
                    new YarnApplication(),
                },
                SparkSqlJob             = new SparkSqlJob(),
                StatusHistory           = { new JobStatus(), },
                DriverControlFilesUri   = "driver_control_files_uribe41e88b",
                DriverOutputResourceUri = "driver_output_resource_urie2b470d7",
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                Scheduling = new JobScheduling(),
                SparkRJob  = new SparkRJob(),
                JobUuid    = "job_uuid7530ffdd",
                PrestoJob  = new PrestoJob(),
                Done       = true,
            };

            mockGrpcClient.Setup(x => x.UpdateJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Job>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);
            Job responseCallSettings   = await client.UpdateJobAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Job responseCancellationToken = await client.UpdateJobAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public async Task UpdateJobAsync()
        {
            Mock <JobController.JobControllerClient> mockGrpcClient = new Mock <JobController.JobControllerClient>(MockBehavior.Strict);
            UpdateJobRequest request = new UpdateJobRequest
            {
                ProjectId  = "projectId-1969970175",
                Region     = "region-934795532",
                JobId      = "jobId-1154752291",
                Job        = new Job(),
                UpdateMask = new FieldMask(),
            };
            Job expectedResponse = new Job
            {
                DriverOutputResourceUri = "driverOutputResourceUri-542229086",
                DriverControlFilesUri   = "driverControlFilesUri207057643",
                JobUuid = "jobUuid-1615012099",
            };

            mockGrpcClient.Setup(x => x.UpdateJobAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Job>(Task.FromResult(expectedResponse), null, null, null, null));
            JobControllerClient client = new JobControllerClientImpl(mockGrpcClient.Object, null);
            Job response = await client.UpdateJobAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }