Beispiel #1
0
        public async stt::Task AddBatchJobOperations2ResourceNamesAsync()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            AddBatchJobOperationsRequest request = new AddBatchJobOperationsRequest
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
                MutateOperations           =
                {
                    new MutateOperation(),
                },
            };
            AddBatchJobOperationsResponse expectedResponse = new AddBatchJobOperationsResponse
            {
                TotalOperations   = -8188520186954789005L,
                NextSequenceToken = "next_sequence_token160dabc7",
            };

            mockGrpcClient.Setup(x => x.AddBatchJobOperationsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AddBatchJobOperationsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            BatchJobServiceClient         client = new BatchJobServiceClientImpl(mockGrpcClient.Object, null);
            AddBatchJobOperationsResponse responseCallSettings = await client.AddBatchJobOperationsAsync(request.ResourceNameAsBatchJobName, request.MutateOperations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            AddBatchJobOperationsResponse responseCancellationToken = await client.AddBatchJobOperationsAsync(request.ResourceNameAsBatchJobName, request.MutateOperations, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public async stt::Task MutateBatchJobRequestObjectAsync()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            MutateBatchJobRequest request = new MutateBatchJobRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operation  = new BatchJobOperation(),
            };
            MutateBatchJobResponse expectedResponse = new MutateBatchJobResponse
            {
                Result = new MutateBatchJobResult(),
            };

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

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateBatchJobResponse responseCancellationToken = await client.MutateBatchJobAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #3
0
        public void AddBatchJobOperations2ResourceNames()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            AddBatchJobOperationsRequest request = new AddBatchJobOperationsRequest
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
                MutateOperations           =
                {
                    new MutateOperation(),
                },
            };
            AddBatchJobOperationsResponse expectedResponse = new AddBatchJobOperationsResponse
            {
                TotalOperations   = -8188520186954789005L,
                NextSequenceToken = "next_sequence_token160dabc7",
            };

            mockGrpcClient.Setup(x => x.AddBatchJobOperations(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            BatchJobServiceClient         client   = new BatchJobServiceClientImpl(mockGrpcClient.Object, null);
            AddBatchJobOperationsResponse response = client.AddBatchJobOperations(request.ResourceNameAsBatchJobName, request.MutateOperations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #4
0
        public async stt::Task GetBatchJobResourceNamesAsync()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetBatchJobRequest request = new GetBatchJobRequest
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
            };
            gagvr::BatchJob expectedResponse = new gagvr::BatchJob
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
                Id = -6774108720365892680L,
                NextAddSequenceToken = "next_add_sequence_token93fee49d",
                Metadata             = new gagvr::BatchJob.Types.BatchJobMetadata(),
                Status = gagve::BatchJobStatusEnum.Types.BatchJobStatus.Done,
                LongRunningOperation = "long_running_operation0897bd41",
            };

            mockGrpcClient.Setup(x => x.GetBatchJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::BatchJob>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            BatchJobServiceClient client = new BatchJobServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::BatchJob       responseCallSettings = await client.GetBatchJobAsync(request.ResourceNameAsBatchJobName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::BatchJob responseCancellationToken = await client.GetBatchJobAsync(request.ResourceNameAsBatchJobName, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetBatchJobResourceNames()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetBatchJobRequest request = new GetBatchJobRequest
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
            };
            gagvr::BatchJob expectedResponse = new gagvr::BatchJob
            {
                ResourceNameAsBatchJobName = gagvr::BatchJobName.FromCustomerBatchJob("[CUSTOMER]", "[BATCH_JOB]"),
                Id = -6774108720365892680L,
                NextAddSequenceToken = "next_add_sequence_token93fee49d",
                Metadata             = new gagvr::BatchJob.Types.BatchJobMetadata(),
                Status = gagve::BatchJobStatusEnum.Types.BatchJobStatus.Done,
                LongRunningOperation = "long_running_operation0897bd41",
            };

            mockGrpcClient.Setup(x => x.GetBatchJob(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            BatchJobServiceClient client   = new BatchJobServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::BatchJob       response = client.GetBatchJob(request.ResourceNameAsBatchJobName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #6
0
        public void MutateBatchJob()
        {
            moq::Mock <BatchJobService.BatchJobServiceClient> mockGrpcClient = new moq::Mock <BatchJobService.BatchJobServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            MutateBatchJobRequest request = new MutateBatchJobRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operation  = new BatchJobOperation(),
            };
            MutateBatchJobResponse expectedResponse = new MutateBatchJobResponse
            {
                Result = new MutateBatchJobResult(),
            };

            mockGrpcClient.Setup(x => x.MutateBatchJob(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            BatchJobServiceClient  client   = new BatchJobServiceClientImpl(mockGrpcClient.Object, null);
            MutateBatchJobResponse response = client.MutateBatchJob(request.CustomerId, request.Operation);

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