public async stt::Task UpdateFlowAsync()
        {
            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);
            UpdateFlowRequest request = new UpdateFlowRequest
            {
                Flow       = new Flow(),
                UpdateMask = new wkt::FieldMask(),
            };
            Flow expectedResponse = new Flow
            {
                FlowName         = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                DisplayName      = "display_name137f65c2",
                Description      = "description2cf9da67",
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
                EventHandlers = { new EventHandler(), },
                NluSettings   = new NluSettings(),
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Flow responseCancellationToken = await client.UpdateFlowAsync(request.Flow, request.UpdateMask, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateFlowRequestObject()
        {
            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);
            UpdateFlowRequest request = new UpdateFlowRequest
            {
                Flow         = new Flow(),
                UpdateMask   = new wkt::FieldMask(),
                LanguageCode = "language_code2f6c7160",
            };
            Flow expectedResponse = new Flow
            {
                FlowName         = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                DisplayName      = "display_name137f65c2",
                Description      = "description2cf9da67",
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
                EventHandlers = { new EventHandler(), },
                NluSettings   = new NluSettings(),
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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();
        }
        public void DeleteFlowResourceNames()
        {
            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);
            DeleteFlowRequest request = new DeleteFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

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

            client.DeleteFlow(request.FlowName);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task DeleteFlowResourceNamesAsync()
        {
            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);
            DeleteFlowRequest request = new DeleteFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteFlowAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            FlowsClient client = new FlowsClientImpl(mockGrpcClient.Object, null);
            await client.DeleteFlowAsync(request.FlowName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteFlowAsync(request.FlowName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }