Exemplo n.º 1
0
        public async stt::Task ValidateFlowRequestObjectAsync()
        {
            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);
            ValidateFlowRequest request = new ValidateFlowRequest
            {
                FlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                LanguageCode = "language_code2f6c7160",
            };
            FlowValidationResult expectedResponse = new FlowValidationResult
            {
                FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                ValidationMessages       =
                {
                    new ValidationMessage(),
                },
                UpdateTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.ValidateFlowAsync(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.ValidateFlowAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
        public void ValidateFlowRequestObject()
        {
            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);
            ValidateFlowRequest request = new ValidateFlowRequest
            {
                FlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                LanguageCode = "language_code2f6c7160",
            };
            FlowValidationResult expectedResponse = new FlowValidationResult
            {
                FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                ValidationMessages       =
                {
                    new ValidationMessage(),
                },
                UpdateTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.ValidateFlow(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FlowsClient          client   = new FlowsClientImpl(mockGrpcClient.Object, null);
            FlowValidationResult response = client.ValidateFlow(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 3
0
 /// <summary>Snippet for ValidateFlow</summary>
 public void ValidateFlowRequestObject()
 {
     // Snippet: ValidateFlow(ValidateFlowRequest, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     ValidateFlowRequest request = new ValidateFlowRequest
     {
         FlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
         LanguageCode = "",
     };
     // Make the request
     FlowValidationResult response = flowsClient.ValidateFlow(request);
     // End snippet
 }
Exemplo n.º 4
0
        /// <summary>Snippet for ValidateFlowAsync</summary>
        public async Task ValidateFlowRequestObjectAsync()
        {
            // Snippet: ValidateFlowAsync(ValidateFlowRequest, CallSettings)
            // Additional: ValidateFlowAsync(ValidateFlowRequest, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // Initialize request argument(s)
            ValidateFlowRequest request = new ValidateFlowRequest
            {
                FlowName     = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                LanguageCode = "",
            };
            // Make the request
            FlowValidationResult response = await flowsClient.ValidateFlowAsync(request);

            // End snippet
        }