public async stt::Task GetFlowValidationResultResourceNamesAsync() { moq::Mock <Flows.FlowsClient> mockGrpcClient = new moq::Mock <Flows.FlowsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetFlowValidationResultRequest request = new GetFlowValidationResultRequest { FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"), }; FlowValidationResult expectedResponse = new FlowValidationResult { FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"), ValidationMessages = { new ValidationMessage(), }, UpdateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.GetFlowValidationResultAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <FlowValidationResult>(stt::Task.FromResult(expectedResponse), null, null, null, null)); FlowsClient client = new FlowsClientImpl(mockGrpcClient.Object, null); FlowValidationResult responseCallSettings = await client.GetFlowValidationResultAsync(request.FlowValidationResultName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); FlowValidationResult responseCancellationToken = await client.GetFlowValidationResultAsync(request.FlowValidationResultName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetFlowValidationResultResourceNames() { moq::Mock <Flows.FlowsClient> mockGrpcClient = new moq::Mock <Flows.FlowsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetFlowValidationResultRequest request = new GetFlowValidationResultRequest { FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"), }; FlowValidationResult expectedResponse = new FlowValidationResult { FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"), ValidationMessages = { new ValidationMessage(), }, UpdateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.GetFlowValidationResult(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); FlowsClient client = new FlowsClientImpl(mockGrpcClient.Object, null); FlowValidationResult response = client.GetFlowValidationResult(request.FlowValidationResultName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetFlowValidationResult</summary> public void GetFlowValidationResultRequestObject() { // Snippet: GetFlowValidationResult(GetFlowValidationResultRequest, CallSettings) // Create client FlowsClient flowsClient = FlowsClient.Create(); // Initialize request argument(s) GetFlowValidationResultRequest request = new GetFlowValidationResultRequest { FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"), LanguageCode = "", }; // Make the request FlowValidationResult response = flowsClient.GetFlowValidationResult(request); // End snippet }
/// <summary>Snippet for GetFlowValidationResultAsync</summary> public async Task GetFlowValidationResultRequestObjectAsync() { // Snippet: GetFlowValidationResultAsync(GetFlowValidationResultRequest, CallSettings) // Additional: GetFlowValidationResultAsync(GetFlowValidationResultRequest, CancellationToken) // Create client FlowsClient flowsClient = await FlowsClient.CreateAsync(); // Initialize request argument(s) GetFlowValidationResultRequest request = new GetFlowValidationResultRequest { FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"), LanguageCode = "", }; // Make the request FlowValidationResult response = await flowsClient.GetFlowValidationResultAsync(request); // End snippet }