コード例 #1
0
        public void PostResourceRequestObject()
        {
            moq::Mock <GatewayService.GatewayServiceClient> mockGrpcClient = new moq::Mock <GatewayService.GatewayServiceClient>(moq::MockBehavior.Strict);
            ga::HttpBody request = new ga::HttpBody
            {
                ContentType = "content_type085be0ea",
                Data        = proto::ByteString.CopyFromUtf8("data387f778d"),
                Extensions  = { new wkt::Any(), },
            };
            ga::HttpBody expectedResponse = new ga::HttpBody
            {
                ContentType = "content_type085be0ea",
                Data        = proto::ByteString.CopyFromUtf8("data387f778d"),
                Extensions  = { new wkt::Any(), },
            };

            mockGrpcClient.Setup(x => x.PostResource(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GatewayServiceClient client   = new GatewayServiceClientImpl(mockGrpcClient.Object, null);
            ga::HttpBody         response = client.PostResource(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public async stt::Task BeginTransactionRequestObjectAsync()
        {
            moq::Mock <Firestore.FirestoreClient> mockGrpcClient = new moq::Mock <Firestore.FirestoreClient>(moq::MockBehavior.Strict);
            BeginTransactionRequest request = new BeginTransactionRequest
            {
                Database = "projects/test/databases/databased8eee011",
                Options  = new TransactionOptions(),
            };
            BeginTransactionResponse expectedResponse = new BeginTransactionResponse
            {
                Transaction = proto::ByteString.CopyFromUtf8("transaction6ab7d5f4"),
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
        public void GetCampaignBidModifierRequestObject()
        {
            moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient> mockGrpcClient = new moq::Mock <CampaignBidModifierService.CampaignBidModifierServiceClient>(moq::MockBehavior.Strict);
            GetCampaignBidModifierRequest request = new GetCampaignBidModifierRequest
            {
                ResourceNameAsCampaignBidModifierName = gagvr::CampaignBidModifierName.FromCustomerCampaignBidModifier("[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]"),
            };
            gagvr::CampaignBidModifier expectedResponse = new gagvr::CampaignBidModifier
            {
                ResourceNameAsCampaignBidModifierName = gagvr::CampaignBidModifierName.FromCustomerCampaignBidModifier("[CUSTOMER]", "[CAMPAIGN_BID_MODIFIER]"),
                CampaignAsCampaignName = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                CriterionId            = 8584655242409302840L,
                BidModifier            = 1.6595195068951933E+17,
                InteractionType        = new gagvc::InteractionTypeInfo(),
            };

            mockGrpcClient.Setup(x => x.GetCampaignBidModifier(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignBidModifierServiceClient client   = new CampaignBidModifierServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignBidModifier       response = client.GetCampaignBidModifier(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public void GetAdGroupAsset()
        {
            moq::Mock <AdGroupAssetService.AdGroupAssetServiceClient> mockGrpcClient = new moq::Mock <AdGroupAssetService.AdGroupAssetServiceClient>(moq::MockBehavior.Strict);
            GetAdGroupAssetRequest request = new GetAdGroupAssetRequest
            {
                ResourceNameAsAdGroupAssetName = gagvr::AdGroupAssetName.FromCustomerAdGroupAssetFieldType("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
            };
            gagvr::AdGroupAsset expectedResponse = new gagvr::AdGroupAsset
            {
                ResourceNameAsAdGroupAssetName = gagvr::AdGroupAssetName.FromCustomerAdGroupAssetFieldType("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
                AdGroupAsAdGroupName           = gagvr::AdGroupName.FromCustomerAdGroup("[CUSTOMER_ID]", "[AD_GROUP_ID]"),
                AssetAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                FieldType        = gagve::AssetFieldTypeEnum.Types.AssetFieldType.YoutubeVideo,
                Status           = gagve::AssetLinkStatusEnum.Types.AssetLinkStatus.Paused,
            };

            mockGrpcClient.Setup(x => x.GetAdGroupAsset(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AdGroupAssetServiceClient client   = new AdGroupAssetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::AdGroupAsset       response = client.GetAdGroupAsset(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #5
0
        public void GetAutoscalingPolicyResourceNames()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            GetAutoscalingPolicyRequest request = new GetAutoscalingPolicyRequest
            {
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id = "id74b70bb8",
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
                BasicAlgorithm        = new BasicAutoscalingAlgorithm(),
                WorkerConfig          = new InstanceGroupAutoscalingPolicyConfig(),
                SecondaryWorkerConfig = new InstanceGroupAutoscalingPolicyConfig(),
            };

            mockGrpcClient.Setup(x => x.GetAutoscalingPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy response            = client.GetAutoscalingPolicy(request.AutoscalingPolicyName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetCombinedAudience()
        {
            moq::Mock <CombinedAudienceService.CombinedAudienceServiceClient> mockGrpcClient = new moq::Mock <CombinedAudienceService.CombinedAudienceServiceClient>(moq::MockBehavior.Strict);
            GetCombinedAudienceRequest request = new GetCombinedAudienceRequest
            {
                ResourceNameAsCombinedAudienceName = gagvr::CombinedAudienceName.FromCustomerCombinedAudience("[CUSTOMER_ID]", "[COMBINED_AUDIENCE_ID]"),
            };
            gagvr::CombinedAudience expectedResponse = new gagvr::CombinedAudience
            {
                ResourceNameAsCombinedAudienceName = gagvr::CombinedAudienceName.FromCustomerCombinedAudience("[CUSTOMER_ID]", "[COMBINED_AUDIENCE_ID]"),
                Id     = -6774108720365892680L,
                Status = gagve::CombinedAudienceStatusEnum.Types.CombinedAudienceStatus.Enabled,
                CombinedAudienceName = gagvr::CombinedAudienceName.FromCustomerCombinedAudience("[CUSTOMER_ID]", "[COMBINED_AUDIENCE_ID]"),
                Description          = "description2cf9da67",
            };

            mockGrpcClient.Setup(x => x.GetCombinedAudience(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CombinedAudienceServiceClient client   = new CombinedAudienceServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CombinedAudience       response = client.GetCombinedAudience(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #7
0
        public void GetCustomerClientLink()
        {
            moq::Mock <CustomerClientLinkService.CustomerClientLinkServiceClient> mockGrpcClient = new moq::Mock <CustomerClientLinkService.CustomerClientLinkServiceClient>(moq::MockBehavior.Strict);
            GetCustomerClientLinkRequest request = new GetCustomerClientLinkRequest
            {
                ResourceNameAsCustomerClientLinkName = gagvr::CustomerClientLinkName.FromCustomerCustomerClientLink("[CUSTOMER]", "[CUSTOMER_CLIENT_LINK]"),
            };
            gagvr::CustomerClientLink expectedResponse = new gagvr::CustomerClientLink
            {
                ResourceNameAsCustomerClientLinkName = gagvr::CustomerClientLinkName.FromCustomerCustomerClientLink("[CUSTOMER]", "[CUSTOMER_CLIENT_LINK]"),
                ClientCustomerAsCustomerName         = gagvr::CustomerName.FromCustomer("[CUSTOMER]"),
                ManagerLinkId = 1955158851327798968L,
                Status        = gagve::ManagerLinkStatusEnum.Types.ManagerLinkStatus.Inactive,
                Hidden        = true,
            };

            mockGrpcClient.Setup(x => x.GetCustomerClientLink(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerClientLinkServiceClient client   = new CustomerClientLinkServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CustomerClientLink       response = client.GetCustomerClientLink(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #8
0
        public async stt::Task GetLandingPageViewAsync()
        {
            moq::Mock <LandingPageViewService.LandingPageViewServiceClient> mockGrpcClient = new moq::Mock <LandingPageViewService.LandingPageViewServiceClient>(moq::MockBehavior.Strict);
            GetLandingPageViewRequest request = new GetLandingPageViewRequest
            {
                ResourceNameAsLandingPageViewName = gagvr::LandingPageViewName.FromCustomerUnexpandedFinalUrlFingerprint("[CUSTOMER_ID]", "[UNEXPANDED_FINAL_URL_FINGERPRINT]"),
            };
            gagvr::LandingPageView expectedResponse = new gagvr::LandingPageView
            {
                ResourceNameAsLandingPageViewName = gagvr::LandingPageViewName.FromCustomerUnexpandedFinalUrlFingerprint("[CUSTOMER_ID]", "[UNEXPANDED_FINAL_URL_FINGERPRINT]"),
                UnexpandedFinalUrl = "unexpanded_final_url7d6e0a3e",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #9
0
        public void GetKeywordPlanAdGroup()
        {
            moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanAdGroupService.KeywordPlanAdGroupServiceClient>(moq::MockBehavior.Strict);
            GetKeywordPlanAdGroupRequest request = new GetKeywordPlanAdGroupRequest
            {
                ResourceNameAsKeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"),
            };
            gagvr::KeywordPlanAdGroup expectedResponse = new gagvr::KeywordPlanAdGroup
            {
                ResourceNameAsKeywordPlanAdGroupName         = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"),
                KeywordPlanCampaignAsKeywordPlanCampaignName = gagvr::KeywordPlanCampaignName.FromCustomerKeywordPlanCampaign("[CUSTOMER]", "[KEYWORD_PLAN_CAMPAIGN]"),
                Id = -6774108720365892680L,
                KeywordPlanAdGroupName = gagvr::KeywordPlanAdGroupName.FromCustomerKeywordPlanAdGroup("[CUSTOMER]", "[KEYWORD_PLAN_AD_GROUP]"),
                CpcBidMicros           = 7321761304249472746L,
            };

            mockGrpcClient.Setup(x => x.GetKeywordPlanAdGroup(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            KeywordPlanAdGroupServiceClient client   = new KeywordPlanAdGroupServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::KeywordPlanAdGroup       response = client.GetKeywordPlanAdGroup(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #10
0
        public void MutateAds()
        {
            moq::Mock <AdService.AdServiceClient> mockGrpcClient = new moq::Mock <AdService.AdServiceClient>(moq::MockBehavior.Strict);
            MutateAdsRequest request = new MutateAdsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations = { new AdOperation(), },
            };
            MutateAdsResponse expectedResponse = new MutateAdsResponse
            {
                Results =
                {
                    new MutateAdResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateAds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AdServiceClient   client   = new AdServiceClientImpl(mockGrpcClient.Object, null);
            MutateAdsResponse response = client.MutateAds(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #11
0
        public async stt::Task GetFeedPlaceholderViewRequestObjectAsync()
        {
            moq::Mock <FeedPlaceholderViewService.FeedPlaceholderViewServiceClient> mockGrpcClient = new moq::Mock <FeedPlaceholderViewService.FeedPlaceholderViewServiceClient>(moq::MockBehavior.Strict);
            GetFeedPlaceholderViewRequest request = new GetFeedPlaceholderViewRequest
            {
                ResourceNameAsFeedPlaceholderViewName = gagvr::FeedPlaceholderViewName.FromCustomerFeedPlaceholderView("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]"),
            };
            gagvr::FeedPlaceholderView expectedResponse = new gagvr::FeedPlaceholderView
            {
                ResourceNameAsFeedPlaceholderViewName = gagvr::FeedPlaceholderViewName.FromCustomerFeedPlaceholderView("[CUSTOMER]", "[FEED_PLACEHOLDER_VIEW]"),
                PlaceholderType = gagve::PlaceholderTypeEnum.Types.PlaceholderType.Message,
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 public async stt::Task GetCurrencyConstantRequestObjectAsync()
 {
     moq::Mock<CurrencyConstantService.CurrencyConstantServiceClient> mockGrpcClient = new moq::Mock<CurrencyConstantService.CurrencyConstantServiceClient>(moq::MockBehavior.Strict);
     GetCurrencyConstantRequest request = new GetCurrencyConstantRequest
     {
         ResourceNameAsCurrencyConstantName = gagvr::CurrencyConstantName.FromCode("[CODE]"),
     };
     gagvr::CurrencyConstant expectedResponse = new gagvr::CurrencyConstant
     {
         ResourceNameAsCurrencyConstantName = gagvr::CurrencyConstantName.FromCode("[CODE]"),
         Code = "code946733c1",
         CurrencyConstantName = gagvr::CurrencyConstantName.FromCode("[CODE]"),
         Symbol = "symbol68f2bf97",
         BillableUnitMicros = -4065431154313687083L,
     };
     mockGrpcClient.Setup(x => x.GetCurrencyConstantAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<gagvr::CurrencyConstant>(stt::Task.FromResult(expectedResponse), null, null, null, null));
     CurrencyConstantServiceClient client = new CurrencyConstantServiceClientImpl(mockGrpcClient.Object, null);
     gagvr::CurrencyConstant responseCallSettings = await client.GetCurrencyConstantAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));
     Assert.AreEqual(expectedResponse, responseCallSettings);
     gagvr::CurrencyConstant responseCancellationToken = await client.GetCurrencyConstantAsync(request, st::CancellationToken.None);
     Assert.AreEqual(expectedResponse, responseCancellationToken);
     mockGrpcClient.VerifyAll();
 }
コード例 #13
0
        public void GetGroup()
        {
            moq::Mock <GroupService.GroupServiceClient> mockGrpcClient = new moq::Mock <GroupService.GroupServiceClient>(moq::MockBehavior.Strict);
            GetGroupRequest request = new GetGroupRequest
            {
                GroupName = GroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
            };
            Group expectedResponse = new Group
            {
                GroupName   = GroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
                DisplayName = "display_name137f65c2",
                ParentName  = "parent_name91315215",
                Filter      = "filtere47ac9b2",
                IsCluster   = true,
            };

            mockGrpcClient.Setup(x => x.GetGroup(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GroupServiceClient client = new GroupServiceClientImpl(mockGrpcClient.Object, null);
            Group response            = client.GetGroup(request.Name);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #14
0
        public async stt::Task GetAsync()
        {
            moq::Mock <ImageFamilyViews.ImageFamilyViewsClient> mockGrpcClient = new moq::Mock <ImageFamilyViews.ImageFamilyViewsClient>(moq::MockBehavior.Strict);
            GetImageFamilyViewRequest request = new GetImageFamilyViewRequest
            {
                Zone    = "zone255f4ea8",
                Project = "projectaa6ff846",
                Family  = "family0bda3f0d",
            };
            ImageFamilyView expectedResponse = new ImageFamilyView {
                Image = new Image(),
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ImageFamilyView>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ImageFamilyViewsClient client = new ImageFamilyViewsClientImpl(mockGrpcClient.Object, null);
            ImageFamilyView        responseCallSettings = await client.GetAsync(request.Project, request.Zone, request.Family, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            ImageFamilyView responseCancellationToken = await client.GetAsync(request.Project, request.Zone, request.Family, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #15
0
        public async stt::Task MutateMerchantCenterLinkAsync()
        {
            moq::Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new moq::Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient>(moq::MockBehavior.Strict);
            MutateMerchantCenterLinkRequest request = new MutateMerchantCenterLinkRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operation  = new MerchantCenterLinkOperation(),
            };
            MutateMerchantCenterLinkResponse expectedResponse = new MutateMerchantCenterLinkResponse
            {
                Result = new MutateMerchantCenterLinkResult(),
            };

            mockGrpcClient.Setup(x => x.MutateMerchantCenterLinkAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateMerchantCenterLinkResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            MerchantCenterLinkServiceClient  client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null);
            MutateMerchantCenterLinkResponse responseCallSettings = await client.MutateMerchantCenterLinkAsync(request.CustomerId, request.Operation, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateMerchantCenterLinkResponse responseCancellationToken = await client.MutateMerchantCenterLinkAsync(request.CustomerId, request.Operation, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #16
0
        public void SearchUris()
        {
            moq::Mock <WebRiskService.WebRiskServiceClient> mockGrpcClient = new moq::Mock <WebRiskService.WebRiskServiceClient>(moq::MockBehavior.Strict);
            SearchUrisRequest request = new SearchUrisRequest
            {
                Uri         = "uri3db70593",
                ThreatTypes =
                {
                    ThreatType.SocialEngineering,
                },
            };
            SearchUrisResponse expectedResponse = new SearchUrisResponse
            {
                Threat = new SearchUrisResponse.Types.ThreatUri(),
            };

            mockGrpcClient.Setup(x => x.SearchUris(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            WebRiskServiceClient client   = new WebRiskServiceClientImpl(mockGrpcClient.Object, null);
            SearchUrisResponse   response = client.SearchUris(request.Uri, request.ThreatTypes);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetGroupPlacementView()
        {
            moq::Mock <GroupPlacementViewService.GroupPlacementViewServiceClient> mockGrpcClient = new moq::Mock <GroupPlacementViewService.GroupPlacementViewServiceClient>(moq::MockBehavior.Strict);
            GetGroupPlacementViewRequest request = new GetGroupPlacementViewRequest
            {
                ResourceNameAsGroupPlacementViewName = gagvr::GroupPlacementViewName.FromCustomerGroupPlacementView("[CUSTOMER]", "[GROUP_PLACEMENT_VIEW]"),
            };
            gagvr::GroupPlacementView expectedResponse = new gagvr::GroupPlacementView
            {
                ResourceNameAsGroupPlacementViewName = gagvr::GroupPlacementViewName.FromCustomerGroupPlacementView("[CUSTOMER]", "[GROUP_PLACEMENT_VIEW]"),
                Placement     = "placementb440552a",
                DisplayName   = "display_name137f65c2",
                TargetUrl     = "target_url95bdaf9b",
                PlacementType = gagve::PlacementTypeEnum.Types.PlacementType.Website,
            };

            mockGrpcClient.Setup(x => x.GetGroupPlacementView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GroupPlacementViewServiceClient client   = new GroupPlacementViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::GroupPlacementView       response = client.GetGroupPlacementView(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetKeyRequestObject()
        {
            moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client>(moq::MockBehavior.Strict);
            GetKeyRequest request = new GetKeyRequest
            {
                KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"),
            };
            Key expectedResponse = new Key
            {
                KeyName         = KeyName.FromProjectKey("[PROJECT]", "[KEY]"),
                DisplayName     = "display_name137f65c2",
                WebSettings     = new WebKeySettings(),
                AndroidSettings = new AndroidKeySettings(),
                IosSettings     = new IOSKeySettings(),
            };

            mockGrpcClient.Setup(x => x.GetKey(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            RecaptchaEnterpriseServiceV1Beta1Client client = new RecaptchaEnterpriseServiceV1Beta1ClientImpl(mockGrpcClient.Object, null);
            Key response = client.GetKey(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #19
0
 public void ListInvoices()
 {
     moq::Mock<InvoiceService.InvoiceServiceClient> mockGrpcClient = new moq::Mock<InvoiceService.InvoiceServiceClient>(moq::MockBehavior.Strict);
     ListInvoicesRequest request = new ListInvoicesRequest
     {
         CustomerId = "customer_id3b3724cb",
         BillingSetup = "billing_setupa2c2701f",
         IssueYear = "issue_yeara1ebdef1",
         IssueMonth = gagve::MonthOfYearEnum.Types.MonthOfYear.January,
     };
     ListInvoicesResponse expectedResponse = new ListInvoicesResponse
     {
         Invoices =
         {
             new gagvr::Invoice(),
         },
     };
     mockGrpcClient.Setup(x => x.ListInvoices(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
     InvoiceServiceClient client = new InvoiceServiceClientImpl(mockGrpcClient.Object, null);
     ListInvoicesResponse response = client.ListInvoices(request.CustomerId, request.BillingSetup, request.IssueYear, request.IssueMonth);
     Assert.AreEqual(expectedResponse, response);
     mockGrpcClient.VerifyAll();
 }
コード例 #20
0
        public async stt::Task GetExpandedLandingPageViewRequestObjectAsync()
        {
            moq::Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient> mockGrpcClient = new moq::Mock <ExpandedLandingPageViewService.ExpandedLandingPageViewServiceClient>(moq::MockBehavior.Strict);
            GetExpandedLandingPageViewRequest request = new GetExpandedLandingPageViewRequest
            {
                ResourceNameAsExpandedLandingPageViewName = gagvr::ExpandedLandingPageViewName.FromCustomerExpandedLandingPageView("[CUSTOMER]", "[EXPANDED_LANDING_PAGE_VIEW]"),
            };
            gagvr::ExpandedLandingPageView expectedResponse = new gagvr::ExpandedLandingPageView
            {
                ResourceNameAsExpandedLandingPageViewName = gagvr::ExpandedLandingPageViewName.FromCustomerExpandedLandingPageView("[CUSTOMER]", "[EXPANDED_LANDING_PAGE_VIEW]"),
                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, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #21
0
        public async stt::Task GetTenantResourceNamesAsync()
        {
            moq::Mock <TenantService.TenantServiceClient> mockGrpcClient = new moq::Mock <TenantService.TenantServiceClient>(moq::MockBehavior.Strict);
            GetTenantRequest request = new GetTenantRequest
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
            };
            Tenant expectedResponse = new Tenant
            {
                TenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
                ExternalId = "external_id9442680e",
            };

            mockGrpcClient.Setup(x => x.GetTenantAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Tenant>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TenantServiceClient client  = new TenantServiceClientImpl(mockGrpcClient.Object, null);
            Tenant responseCallSettings = await client.GetTenantAsync(request.TenantName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Tenant responseCancellationToken = await client.GetTenantAsync(request.TenantName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #22
0
        public void GetVideo()
        {
            moq::Mock <VideoService.VideoServiceClient> mockGrpcClient = new moq::Mock <VideoService.VideoServiceClient>(moq::MockBehavior.Strict);
            GetVideoRequest request = new GetVideoRequest
            {
                ResourceNameAsVideoName = gagvr::VideoName.FromCustomerVideo("[CUSTOMER_ID]", "[VIDEO_ID]"),
            };
            gagvr::Video expectedResponse = new gagvr::Video
            {
                ResourceNameAsVideoName = gagvr::VideoName.FromCustomerVideo("[CUSTOMER_ID]", "[VIDEO_ID]"),
                Id             = "id74b70bb8",
                ChannelId      = "channel_id856ceb72",
                DurationMillis = 4964327688054496886L,
                Title          = "title17dbd3d5",
            };

            mockGrpcClient.Setup(x => x.GetVideo(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            VideoServiceClient client   = new VideoServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::Video       response = client.GetVideo(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #23
0
        public void List()
        {
            moq::Mock <Licenses.LicensesClient> mockGrpcClient = new moq::Mock <Licenses.LicensesClient>(moq::MockBehavior.Strict);
            ListLicensesRequest request = new ListLicensesRequest
            {
                Project = "projectaa6ff846",
            };
            LicensesListResponse expectedResponse = new LicensesListResponse
            {
                Id            = "id74b70bb8",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new License(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            LicensesClient       client   = new LicensesClientImpl(mockGrpcClient.Object, null);
            LicensesListResponse response = client.List(request.Project);

            xunit::Assert.Same(expectedResponse, response);
            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.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.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();
        }
        public async stt::Task AggregatedListAsync()
        {
            moq::Mock <RegionCommitments.RegionCommitmentsClient> mockGrpcClient = new moq::Mock <RegionCommitments.RegionCommitmentsClient>(moq::MockBehavior.Strict);
            AggregatedListRegionCommitmentsRequest request = new AggregatedListRegionCommitmentsRequest
            {
                Project = "projectaa6ff846",
            };
            CommitmentAggregatedList expectedResponse = new CommitmentAggregatedList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    {
                        "key8a0b6e3c",
                        new CommitmentsScopedList()
                    },
                },
                Unreachables =
                {
                    "unreachables3ca950ee",
                },
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.AggregatedListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CommitmentAggregatedList>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            RegionCommitmentsClient  client = new RegionCommitmentsClientImpl(mockGrpcClient.Object, null);
            CommitmentAggregatedList responseCallSettings = await client.AggregatedListAsync(request.Project, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            CommitmentAggregatedList responseCancellationToken = await client.AggregatedListAsync(request.Project, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
コード例 #26
0
        public void GetFeedItemRequestObject()
        {
            moq::Mock <FeedItemService.FeedItemServiceClient> mockGrpcClient = new moq::Mock <FeedItemService.FeedItemServiceClient>(moq::MockBehavior.Strict);
            GetFeedItemRequest request = new GetFeedItemRequest
            {
                ResourceNameAsFeedItemName = gagvr::FeedItemName.FromCustomerFeedItem("[CUSTOMER]", "[FEED_ITEM]"),
            };
            gagvr::FeedItem expectedResponse = new gagvr::FeedItem
            {
                ResourceNameAsFeedItemName = gagvr::FeedItemName.FromCustomerFeedItem("[CUSTOMER]", "[FEED_ITEM]"),
                FeedAsFeedName             = gagvr::FeedName.FromCustomerFeed("[CUSTOMER]", "[FEED]"),
                Id              = -6774108720365892680L,
                StartDateTime   = "start_date_timeea924cb1",
                EndDateTime     = "end_date_timea95363f3",
                AttributeValues =
                {
                    new gagvr::FeedItemAttributeValue(),
                },
                GeoTargetingRestriction = gagve::GeoTargetingRestrictionEnum.Types.GeoTargetingRestriction.LocationOfPresence,
                UrlCustomParameters     =
                {
                    new gagvc::CustomParameter(),
                },
                Status      = gagve::FeedItemStatusEnum.Types.FeedItemStatus.Enabled,
                PolicyInfos =
                {
                    new gagvr::FeedItemPlaceholderPolicyInfo(),
                },
            };

            mockGrpcClient.Setup(x => x.GetFeedItem(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedItemServiceClient client   = new FeedItemServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::FeedItem       response = client.GetFeedItem(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #27
0
        public void CreateTopicRequestObject()
        {
            moq::Mock <Publisher.PublisherClient> mockGrpcClient = new moq::Mock <Publisher.PublisherClient>(moq::MockBehavior.Strict);
            Topic request = new Topic
            {
                TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
                Labels    =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                MessageStoragePolicy = new MessageStoragePolicy(),
                KmsKeyName           = "kms_key_name06bd122b",
            };
            Topic expectedResponse = new Topic
            {
                TopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
                Labels    =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                MessageStoragePolicy = new MessageStoragePolicy(),
                KmsKeyName           = "kms_key_name06bd122b",
            };

            mockGrpcClient.Setup(x => x.CreateTopic(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            PublisherServiceApiClient client = new PublisherServiceApiClientImpl(mockGrpcClient.Object, null);
            Topic response = client.CreateTopic(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #28
0
        public void UpdateLogMetricResourceNames()
        {
            moq::Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new moq::Mock <MetricsServiceV2.MetricsServiceV2Client>(moq::MockBehavior.Strict);
            UpdateLogMetricRequest request = new UpdateLogMetricRequest
            {
                MetricNameAsMetricName = MetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
                Metric = new LogMetric(),
            };
            LogMetric expectedResponse = new LogMetric
            {
                MetricName  = MetricName.FromProjectMetric("[PROJECT]", "[METRIC]"),
                Description = "description2cf9da67",
                Filter      = "filtere47ac9b2",
#pragma warning disable CS0612
                Version = LogMetric.Types.ApiVersion.V2,
#pragma warning restore CS0612
                MetricDescriptor = new ga::MetricDescriptor(),
                ValueExtractor   = "value_extractor09b994a6",
                LabelExtractors  =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                BucketOptions = new ga::Distribution.Types.BucketOptions(),
                CreateTime    = new wkt::Timestamp(),
                UpdateTime    = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.UpdateLogMetric(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null);
            LogMetric response            = client.UpdateLogMetric(request.MetricNameAsMetricName, request.Metric);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #29
0
        public void GetRequestObject()
        {
            moq::Mock <InterconnectLocations.InterconnectLocationsClient> mockGrpcClient = new moq::Mock <InterconnectLocations.InterconnectLocationsClient>(moq::MockBehavior.Strict);
            GetInterconnectLocationRequest request = new GetInterconnectLocationRequest
            {
                InterconnectLocation = "interconnect_location365a00f5",
                Project = "projectaa6ff846",
            };
            InterconnectLocation expectedResponse = new InterconnectLocation
            {
                Id   = "id74b70bb8",
                City = "cityead2d54e",
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp = "creation_timestamp235e59a1",
                RegionInfos       =
                {
                    new InterconnectLocationRegionInfo(),
                },
                FacilityProviderFacilityId = "facility_provider_facility_id936c09db",
                Continent           = InterconnectLocation.Types.Continent.CAfrica,
                Description         = "description2cf9da67",
                AvailabilityZone    = "availability_zone1778d0ba",
                Status              = InterconnectLocation.Types.Status.Closed,
                SelfLink            = "self_link7e87f12d",
                Address             = "address04984d88",
                FacilityProvider    = "facility_provider3fff5132",
                PeeringdbFacilityId = "peeringdb_facility_idcce67e85",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            InterconnectLocationsClient client   = new InterconnectLocationsClientImpl(mockGrpcClient.Object, null);
            InterconnectLocation        response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #30
0
        public void Get()
        {
            moq::Mock <Routes.RoutesClient> mockGrpcClient = new moq::Mock <Routes.RoutesClient>(moq::MockBehavior.Strict);
            GetRouteRequest request = new GetRouteRequest
            {
                Route   = "route8a40469c",
                Project = "projectaa6ff846",
            };
            Route expectedResponse = new Route
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                Tags = { "tags52c47ad5", },
                CreationTimestamp = "creation_timestamp235e59a1",
                NextHopIp         = "next_hop_ipa30be6cf",
                NextHopIlb        = "next_hop_ilbbb4605ad",
                Network           = "networkd22ce091",
                NextHopNetwork    = "next_hop_networkec878a41",
                NextHopGateway    = "next_hop_gateway86a0bbe5",
                DestRange         = "dest_range56ada943",
                NextHopInstance   = "next_hop_instance57e80635",
                NextHopPeering    = "next_hop_peering2cca5109",
                Description       = "description2cf9da67",
                Priority          = 1546225849U,
                SelfLink          = "self_link7e87f12d",
                Warnings          = { new Warnings(), },
                NextHopVpnTunnel  = "next_hop_vpn_tunnela5f8e0c5",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            RoutesClient client   = new RoutesClientImpl(mockGrpcClient.Object, null);
            Route        response = client.Get(request.Project, request.Route);

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