예제 #1
0
        public async stt::Task CreatePageResourceNamesAsync()
        {
            moq::Mock <Pages.PagesClient> mockGrpcClient = new moq::Mock <Pages.PagesClient>(moq::MockBehavior.Strict);
            CreatePageRequest             request        = new CreatePageRequest
            {
                ParentAsFlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                Page             = new Page(),
            };
            Page expectedResponse = new Page
            {
                PageName         = PageName.FromProjectLocationAgentFlowPage("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[PAGE]"),
                DisplayName      = "display_name137f65c2",
                Form             = new Form(),
                EntryFulfillment = new Fulfillment(),
                TransitionRoutes =
                {
                    new TransitionRoute(),
                },
                EventHandlers = { new EventHandler(), },
                TransitionRouteGroupsAsTransitionRouteGroupNames =
                {
                    TransitionRouteGroupName.FromProjectLocationAgentFlowTransitionRouteGroup("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]"),
                },
            };

            mockGrpcClient.Setup(x => x.CreatePageAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Page>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            PagesClient client = new PagesClientImpl(mockGrpcClient.Object, null);
            Page        responseCallSettings = await client.CreatePageAsync(request.ParentAsFlowName, request.Page, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Page responseCancellationToken = await client.CreatePageAsync(request.ParentAsFlowName, request.Page, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }