public void GetSpecialistPoolRequestObject() { moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient> mockGrpcClient = new moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSpecialistPoolRequest request = new GetSpecialistPoolRequest { SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"), }; SpecialistPool expectedResponse = new SpecialistPool { SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"), DisplayName = "display_name137f65c2", SpecialistManagersCount = 1389839351, SpecialistManagerEmails = { "specialist_manager_emails54da434d", }, PendingDataLabelingJobs = { "pending_data_labeling_jobsd91cc38b", }, SpecialistWorkerEmails = { "specialist_worker_emailsac41cb4d", }, }; mockGrpcClient.Setup(x => x.GetSpecialistPool(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SpecialistPoolServiceClient client = new SpecialistPoolServiceClientImpl(mockGrpcClient.Object, null); SpecialistPool response = client.GetSpecialistPool(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetSpecialistPoolRequestObjectAsync() { moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient> mockGrpcClient = new moq::Mock <SpecialistPoolService.SpecialistPoolServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSpecialistPoolRequest request = new GetSpecialistPoolRequest { SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"), }; SpecialistPool expectedResponse = new SpecialistPool { SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"), DisplayName = "display_name137f65c2", SpecialistManagersCount = 1389839351, SpecialistManagerEmails = { "specialist_manager_emails54da434d", }, PendingDataLabelingJobs = { "pending_data_labeling_jobsd91cc38b", }, }; mockGrpcClient.Setup(x => x.GetSpecialistPoolAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SpecialistPool>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SpecialistPoolServiceClient client = new SpecialistPoolServiceClientImpl(mockGrpcClient.Object, null); SpecialistPool responseCallSettings = await client.GetSpecialistPoolAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); SpecialistPool responseCancellationToken = await client.GetSpecialistPoolAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetSpecialistPool</summary> public void GetSpecialistPoolRequestObject() { // Snippet: GetSpecialistPool(GetSpecialistPoolRequest, CallSettings) // Create client SpecialistPoolServiceClient specialistPoolServiceClient = SpecialistPoolServiceClient.Create(); // Initialize request argument(s) GetSpecialistPoolRequest request = new GetSpecialistPoolRequest { SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"), }; // Make the request SpecialistPool response = specialistPoolServiceClient.GetSpecialistPool(request); // End snippet }
/// <summary>Snippet for GetSpecialistPoolAsync</summary> public async Task GetSpecialistPoolRequestObjectAsync() { // Snippet: GetSpecialistPoolAsync(GetSpecialistPoolRequest, CallSettings) // Additional: GetSpecialistPoolAsync(GetSpecialistPoolRequest, CancellationToken) // Create client SpecialistPoolServiceClient specialistPoolServiceClient = await SpecialistPoolServiceClient.CreateAsync(); // Initialize request argument(s) GetSpecialistPoolRequest request = new GetSpecialistPoolRequest { SpecialistPoolName = SpecialistPoolName.FromProjectLocationSpecialistPool("[PROJECT]", "[LOCATION]", "[SPECIALIST_POOL]"), }; // Make the request SpecialistPool response = await specialistPoolServiceClient.GetSpecialistPoolAsync(request); // End snippet }