Exemple #1
0
        public void GetExpandedLandingPageView2()
        {
            Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient> mockGrpcClient = new Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient>(MockBehavior.Strict);
            GetExpandedLandingPageViewRequest request = new GetExpandedLandingPageViewRequest
            {
                ResourceName = new ExpandedLandingPageViewName("[CUSTOMER]", "[EXPANDED_LANDING_PAGE_VIEW]").ToString(),
            };
            ExpandedLandingPageView expectedResponse = new ExpandedLandingPageView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetExpandedLandingPageView(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ExpandedLandingPageViewServiceClient client = new ExpandedLandingPageViewServiceClientImpl(mockGrpcClient.Object, null);
            ExpandedLandingPageView response            = client.GetExpandedLandingPageView(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public void GetExpandedLandingPageView()
        {
            moq::Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient> mockGrpcClient = new moq::Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient>(moq::MockBehavior.Strict);
            GetExpandedLandingPageViewRequest request = new GetExpandedLandingPageViewRequest
            {
                ResourceNameAsExpandedLandingPageViewName = gagvr::ExpandedLandingPageViewName.FromCustomerExpandedFinalUrlFingerprint("[CUSTOMER_ID]", "[EXPANDED_FINAL_URL_FINGERPRINT]"),
            };
            gagvr::ExpandedLandingPageView expectedResponse = new gagvr::ExpandedLandingPageView
            {
                ResourceNameAsExpandedLandingPageViewName = gagvr::ExpandedLandingPageViewName.FromCustomerExpandedFinalUrlFingerprint("[CUSTOMER_ID]", "[EXPANDED_FINAL_URL_FINGERPRINT]"),
                ExpandedFinalUrl = "expanded_final_url4339aa97",
            };

            mockGrpcClient.Setup(x => x.GetExpandedLandingPageView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ExpandedLandingPageViewServiceClient client   = new ExpandedLandingPageViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::ExpandedLandingPageView       response = client.GetExpandedLandingPageView(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
        public async Task GetExpandedLandingPageViewAsync()
        {
            Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient> mockGrpcClient = new Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient>(MockBehavior.Strict);
            GetExpandedLandingPageViewRequest expectedRequest = new GetExpandedLandingPageViewRequest
            {
                ResourceName = new ExpandedLandingPageViewName("[CUSTOMER]", "[EXPANDED_LANDING_PAGE_VIEW]").ToString(),
            };
            ExpandedLandingPageView expectedResponse = new ExpandedLandingPageView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetExpandedLandingPageViewAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <ExpandedLandingPageView>(Task.FromResult(expectedResponse), null, null, null, null));
            ExpandedLandingPageViewServiceClient client = new ExpandedLandingPageViewServiceClientImpl(mockGrpcClient.Object, null);
            string formattedResourceName     = new ExpandedLandingPageViewName("[CUSTOMER]", "[EXPANDED_LANDING_PAGE_VIEW]").ToString();
            ExpandedLandingPageView response = await client.GetExpandedLandingPageViewAsync(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #4
0
        public async stt::Task GetExpandedLandingPageViewAsync()
        {
            moq::Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient> mockGrpcClient = new moq::Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient>(moq::MockBehavior.Strict);
            GetExpandedLandingPageViewRequest request = new GetExpandedLandingPageViewRequest
            {
                ResourceNameAsExpandedLandingPageViewName = gagvr::ExpandedLandingPageViewName.FromCustomerExpandedFinalUrlFingerprint("[CUSTOMER_ID]", "[EXPANDED_FINAL_URL_FINGERPRINT]"),
            };
            gagvr::ExpandedLandingPageView expectedResponse = new gagvr::ExpandedLandingPageView
            {
                ResourceNameAsExpandedLandingPageViewName = gagvr::ExpandedLandingPageViewName.FromCustomerExpandedFinalUrlFingerprint("[CUSTOMER_ID]", "[EXPANDED_FINAL_URL_FINGERPRINT]"),
                ExpandedFinalUrl = "expanded_final_url4339aa97",
            };

            mockGrpcClient.Setup(x => x.GetExpandedLandingPageViewAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::ExpandedLandingPageView>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ExpandedLandingPageViewServiceClient client = new ExpandedLandingPageViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::ExpandedLandingPageView       responseCallSettings = await client.GetExpandedLandingPageViewAsync(request.ResourceName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::ExpandedLandingPageView responseCancellationToken = await client.GetExpandedLandingPageViewAsync(request.ResourceName, st::CancellationToken.None);

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