public async stt::Task CreateOfflineUserDataJobRequestObjectAsync() { moq::Mock <OfflineUserDataJobService.OfflineUserDataJobServiceClient> mockGrpcClient = new moq::Mock <OfflineUserDataJobService.OfflineUserDataJobServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CreateOfflineUserDataJobRequest request = new CreateOfflineUserDataJobRequest { CustomerId = "customer_id3b3724cb", Job = new gagvr::OfflineUserDataJob(), ValidateOnly = true, }; CreateOfflineUserDataJobResponse expectedResponse = new CreateOfflineUserDataJobResponse { ResourceName = "resource_name8cc2e687", }; mockGrpcClient.Setup(x => x.CreateOfflineUserDataJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CreateOfflineUserDataJobResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); OfflineUserDataJobServiceClient client = new OfflineUserDataJobServiceClientImpl(mockGrpcClient.Object, null); CreateOfflineUserDataJobResponse responseCallSettings = await client.CreateOfflineUserDataJobAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); CreateOfflineUserDataJobResponse responseCancellationToken = await client.CreateOfflineUserDataJobAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task CreateOfflineUserDataJobRequestObjectAsync() { moq::Mock <OfflineUserDataJobService.OfflineUserDataJobServiceClient> mockGrpcClient = new moq::Mock <OfflineUserDataJobService.OfflineUserDataJobServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CreateOfflineUserDataJobRequest request = new CreateOfflineUserDataJobRequest { CustomerId = "customer_id3b3724cb", Job = new gagvr::OfflineUserDataJob(), ValidateOnly = true, EnableMatchRateRangePreview = false, }; CreateOfflineUserDataJobResponse expectedResponse = new CreateOfflineUserDataJobResponse { ResourceNameAsOfflineUserDataJobName = gagvr::OfflineUserDataJobName.FromCustomerOfflineUserDataUpdate("[CUSTOMER_ID]", "[OFFLINE_USER_DATA_UPDATE_ID]"), }; mockGrpcClient.Setup(x => x.CreateOfflineUserDataJobAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CreateOfflineUserDataJobResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); OfflineUserDataJobServiceClient client = new OfflineUserDataJobServiceClientImpl(mockGrpcClient.Object, null); CreateOfflineUserDataJobResponse responseCallSettings = await client.CreateOfflineUserDataJobAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); CreateOfflineUserDataJobResponse responseCancellationToken = await client.CreateOfflineUserDataJobAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }