Beispiel #1
0
        public async stt::Task GetChangeStatusRequestObjectAsync()
        {
            moq::Mock <ChangeStatusService.ChangeStatusServiceClient> mockGrpcClient = new moq::Mock <ChangeStatusService.ChangeStatusServiceClient>(moq::MockBehavior.Strict);
            GetChangeStatusRequest request = new GetChangeStatusRequest
            {
                ResourceNameAsChangeStatusName = gagvr::ChangeStatusName.FromCustomerChangeStatus("[CUSTOMER]", "[CHANGE_STATUS]"),
            };
            gagvr::ChangeStatus expectedResponse = new gagvr::ChangeStatus
            {
                ResourceNameAsChangeStatusName = gagvr::ChangeStatusName.FromCustomerChangeStatus("[CUSTOMER]", "[CHANGE_STATUS]"),
                LastChangeDateTime             = "last_change_date_time05524d04",
                ResourceType             = gagve::ChangeStatusResourceTypeEnum.Types.ChangeStatusResourceType.Feed,
                CampaignAsCampaignName   = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                AdGroupAsAdGroupName     = gagvr::AdGroupName.FromCustomerAdGroup("[CUSTOMER]", "[AD_GROUP]"),
                ResourceStatus           = gagve::ChangeStatusOperationEnum.Types.ChangeStatusOperation.Unspecified,
                AdGroupAdAsAdGroupAdName = gagvr::AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER]", "[AD_GROUP_AD]"),
                AdGroupCriterionAsAdGroupCriterionName   = gagvr::AdGroupCriterionName.FromCustomerAdGroupCriterion("[CUSTOMER]", "[AD_GROUP_CRITERION]"),
                CampaignCriterionAsCampaignCriterionName = gagvr::CampaignCriterionName.FromCustomerCampaignCriterion("[CUSTOMER]", "[CAMPAIGN_CRITERION]"),
                FeedAsFeedName                             = gagvr::FeedName.FromCustomerFeed("[CUSTOMER]", "[FEED]"),
                FeedItemAsFeedItemName                     = gagvr::FeedItemName.FromCustomerFeedItem("[CUSTOMER]", "[FEED_ITEM]"),
                AdGroupFeedAsAdGroupFeedName               = gagvr::AdGroupFeedName.FromCustomerAdGroupFeed("[CUSTOMER]", "[AD_GROUP_FEED]"),
                CampaignFeedAsCampaignFeedName             = gagvr::CampaignFeedName.FromCustomerCampaignFeed("[CUSTOMER]", "[CAMPAIGN_FEED]"),
                AdGroupBidModifierAsAdGroupBidModifierName = gagvr::AdGroupBidModifierName.FromCustomerAdGroupBidModifier("[CUSTOMER]", "[AD_GROUP_BID_MODIFIER]"),
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public void GetChangeStatusRequestObject()
        {
            moq::Mock <ChangeStatusService.ChangeStatusServiceClient> mockGrpcClient = new moq::Mock <ChangeStatusService.ChangeStatusServiceClient>(moq::MockBehavior.Strict);
            GetChangeStatusRequest request = new GetChangeStatusRequest
            {
                ResourceNameAsChangeStatusName = gagvr::ChangeStatusName.FromCustomerChangeStatus("[CUSTOMER]", "[CHANGE_STATUS]"),
            };
            gagvr::ChangeStatus expectedResponse = new gagvr::ChangeStatus
            {
                ResourceNameAsChangeStatusName = gagvr::ChangeStatusName.FromCustomerChangeStatus("[CUSTOMER]", "[CHANGE_STATUS]"),
                LastChangeDateTime             = "last_change_date_time05524d04",
                ResourceType             = gagve::ChangeStatusResourceTypeEnum.Types.ChangeStatusResourceType.Feed,
                CampaignAsCampaignName   = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                AdGroupAsAdGroupName     = gagvr::AdGroupName.FromCustomerAdGroup("[CUSTOMER]", "[AD_GROUP]"),
                ResourceStatus           = gagve::ChangeStatusOperationEnum.Types.ChangeStatusOperation.Unspecified,
                AdGroupAdAsAdGroupAdName = gagvr::AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER]", "[AD_GROUP_AD]"),
                AdGroupCriterionAsAdGroupCriterionName   = gagvr::AdGroupCriterionName.FromCustomerAdGroupCriterion("[CUSTOMER]", "[AD_GROUP_CRITERION]"),
                CampaignCriterionAsCampaignCriterionName = gagvr::CampaignCriterionName.FromCustomerCampaignCriterion("[CUSTOMER]", "[CAMPAIGN_CRITERION]"),
                FeedAsFeedName                             = gagvr::FeedName.FromCustomerFeed("[CUSTOMER]", "[FEED]"),
                FeedItemAsFeedItemName                     = gagvr::FeedItemName.FromCustomerFeedItem("[CUSTOMER]", "[FEED_ITEM]"),
                AdGroupFeedAsAdGroupFeedName               = gagvr::AdGroupFeedName.FromCustomerAdGroupFeed("[CUSTOMER]", "[AD_GROUP_FEED]"),
                CampaignFeedAsCampaignFeedName             = gagvr::CampaignFeedName.FromCustomerCampaignFeed("[CUSTOMER]", "[CAMPAIGN_FEED]"),
                AdGroupBidModifierAsAdGroupBidModifierName = gagvr::AdGroupBidModifierName.FromCustomerAdGroupBidModifier("[CUSTOMER]", "[AD_GROUP_BID_MODIFIER]"),
            };

            mockGrpcClient.Setup(x => x.GetChangeStatus(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ChangeStatusServiceClient client   = new ChangeStatusServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::ChangeStatus       response = client.GetChangeStatus(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetChangeStatus2()
        {
            Mock <ChangeStatusService.ChangeStatusServiceClient> mockGrpcClient = new Mock <ChangeStatusService.ChangeStatusServiceClient>(MockBehavior.Strict);
            GetChangeStatusRequest request = new GetChangeStatusRequest
            {
                ResourceName = new ChangeStatusName("[CUSTOMER]", "[CHANGE_STATUS]").ToString(),
            };
            ChangeStatus expectedResponse = new ChangeStatus
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetChangeStatus(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ChangeStatusServiceClient client = new ChangeStatusServiceClientImpl(mockGrpcClient.Object, null);
            ChangeStatus response            = client.GetChangeStatus(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetChangeStatusAsync2()
        {
            Mock <ChangeStatusService.ChangeStatusServiceClient> mockGrpcClient = new Mock <ChangeStatusService.ChangeStatusServiceClient>(MockBehavior.Strict);
            GetChangeStatusRequest request = new GetChangeStatusRequest
            {
                ResourceName = new ChangeStatusName("[CUSTOMER]", "[CHANGE_STATUS]").ToString(),
            };
            ChangeStatus expectedResponse = new ChangeStatus
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetChangeStatusAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <ChangeStatus>(Task.FromResult(expectedResponse), null, null, null, null));
            ChangeStatusServiceClient client = new ChangeStatusServiceClientImpl(mockGrpcClient.Object, null);
            ChangeStatus response            = await client.GetChangeStatusAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #5
0
        public void GetChangeStatusRequestObject()
        {
            moq::Mock <ChangeStatusService.ChangeStatusServiceClient> mockGrpcClient = new moq::Mock <ChangeStatusService.ChangeStatusServiceClient>(moq::MockBehavior.Strict);
            GetChangeStatusRequest request = new GetChangeStatusRequest
            {
                ResourceNameAsChangeStatusName = gagvr::ChangeStatusName.FromCustomerChangeStatus("[CUSTOMER_ID]", "[CHANGE_STATUS_ID]"),
            };
            gagvr::ChangeStatus expectedResponse = new gagvr::ChangeStatus
            {
                ResourceNameAsChangeStatusName = gagvr::ChangeStatusName.FromCustomerChangeStatus("[CUSTOMER_ID]", "[CHANGE_STATUS_ID]"),
                ResourceType             = gagve::ChangeStatusResourceTypeEnum.Types.ChangeStatusResourceType.CampaignSharedSet,
                ResourceStatus           = gagve::ChangeStatusOperationEnum.Types.ChangeStatusOperation.Unspecified,
                CampaignAsCampaignName   = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER_ID]", "[CAMPAIGN_ID]"),
                AdGroupAsAdGroupName     = gagvr::AdGroupName.FromCustomerAdGroup("[CUSTOMER_ID]", "[AD_GROUP_ID]"),
                LastChangeDateTime       = "last_change_date_time05524d04",
                AdGroupAdAsAdGroupAdName = gagvr::AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[AD_ID]"),
                AdGroupCriterionAsAdGroupCriterionName   = gagvr::AdGroupCriterionName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
                CampaignCriterionAsCampaignCriterionName = gagvr::CampaignCriterionName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"),
                FeedAsFeedName                             = gagvr::FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"),
                FeedItemAsFeedItemName                     = gagvr::FeedItemName.FromCustomerFeedFeedItem("[CUSTOMER_ID]", "[FEED_ID]", "[FEED_ITEM_ID]"),
                AdGroupFeedAsAdGroupFeedName               = gagvr::AdGroupFeedName.FromCustomerAdGroupFeed("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[FEED_ID]"),
                CampaignFeedAsCampaignFeedName             = gagvr::CampaignFeedName.FromCustomerCampaignFeed("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[FEED_ID]"),
                AdGroupBidModifierAsAdGroupBidModifierName = gagvr::AdGroupBidModifierName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"),
                SharedSetAsSharedSetName                   = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER_ID]", "[SHARED_SET_ID]"),
                CampaignSharedSetAsCampaignSharedSetName   = gagvr::CampaignSharedSetName.FromCustomerCampaignSharedSet("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[SHARED_SET_ID]"),
                AssetAsAssetName                           = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                CustomerAssetAsCustomerAssetName           = gagvr::CustomerAssetName.FromCustomerAssetFieldType("[CUSTOMER_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
                CampaignAssetAsCampaignAssetName           = gagvr::CampaignAssetName.FromCustomerCampaignAssetFieldType("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
                AdGroupAssetAsAdGroupAssetName             = gagvr::AdGroupAssetName.FromCustomerAdGroupAssetFieldType("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[ASSET_ID]", "[FIELD_TYPE]"),
            };

            mockGrpcClient.Setup(x => x.GetChangeStatus(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ChangeStatusServiceClient client   = new ChangeStatusServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::ChangeStatus       response = client.GetChangeStatus(request);

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