Ejemplo n.º 1
0
        public async stt::Task GetPaidOrganicSearchTermViewRequestObjectAsync()
        {
            moq::Mock <PaidOrganicSearchTermViewService.PaidOrganicSearchTermViewServiceClient> mockGrpcClient = new moq::Mock <PaidOrganicSearchTermViewService.PaidOrganicSearchTermViewServiceClient>(moq::MockBehavior.Strict);
            GetPaidOrganicSearchTermViewRequest request = new GetPaidOrganicSearchTermViewRequest
            {
                ResourceNameAsPaidOrganicSearchTermViewName = gagvr::PaidOrganicSearchTermViewName.FromCustomerPaidOrganicSearchTermView("[CUSTOMER]", "[PAID_ORGANIC_SEARCH_TERM_VIEW]"),
            };
            gagvr::PaidOrganicSearchTermView expectedResponse = new gagvr::PaidOrganicSearchTermView
            {
                ResourceNameAsPaidOrganicSearchTermViewName = gagvr::PaidOrganicSearchTermViewName.FromCustomerPaidOrganicSearchTermView("[CUSTOMER]", "[PAID_ORGANIC_SEARCH_TERM_VIEW]"),
                SearchTerm = "search_term6c01a1df",
            };

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

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::PaidOrganicSearchTermView responseCancellationToken = await client.GetPaidOrganicSearchTermViewAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task GetPaidOrganicSearchTermViewAsync()
        {
            moq::Mock <PaidOrganicSearchTermViewService.PaidOrganicSearchTermViewServiceClient> mockGrpcClient = new moq::Mock <PaidOrganicSearchTermViewService.PaidOrganicSearchTermViewServiceClient>(moq::MockBehavior.Strict);
            GetPaidOrganicSearchTermViewRequest request = new GetPaidOrganicSearchTermViewRequest
            {
                ResourceNameAsPaidOrganicSearchTermViewName = gagvr::PaidOrganicSearchTermViewName.FromCustomerCampaignAdGroupBase64SearchTerm("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[AD_GROUP_ID]", "[BASE64_SEARCH_TERM]"),
            };
            gagvr::PaidOrganicSearchTermView expectedResponse = new gagvr::PaidOrganicSearchTermView
            {
                ResourceNameAsPaidOrganicSearchTermViewName = gagvr::PaidOrganicSearchTermViewName.FromCustomerCampaignAdGroupBase64SearchTerm("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[AD_GROUP_ID]", "[BASE64_SEARCH_TERM]"),
                SearchTerm = "search_term6c01a1df",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 3
0
        public async Task GetPaidOrganicSearchTermViewAsync2()
        {
            Mock <PaidOrganicSearchTermViewService.PaidOrganicSearchTermViewServiceClient> mockGrpcClient = new Mock <PaidOrganicSearchTermViewService.PaidOrganicSearchTermViewServiceClient>(MockBehavior.Strict);
            GetPaidOrganicSearchTermViewRequest request = new GetPaidOrganicSearchTermViewRequest
            {
                ResourceName = new PaidOrganicSearchTermViewName("[CUSTOMER]", "[PAID_ORGANIC_SEARCH_TERM_VIEW]").ToString(),
            };
            PaidOrganicSearchTermView expectedResponse = new PaidOrganicSearchTermView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetPaidOrganicSearchTermViewAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <PaidOrganicSearchTermView>(Task.FromResult(expectedResponse), null, null, null, null));
            PaidOrganicSearchTermViewServiceClient client = new PaidOrganicSearchTermViewServiceClientImpl(mockGrpcClient.Object, null);
            PaidOrganicSearchTermView response            = await client.GetPaidOrganicSearchTermViewAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }