コード例 #1
0
        public void GetCampaignAudienceView()
        {
            moq::Mock <CampaignAudienceViewService.CampaignAudienceViewServiceClient> mockGrpcClient = new moq::Mock <CampaignAudienceViewService.CampaignAudienceViewServiceClient>(moq::MockBehavior.Strict);
            GetCampaignAudienceViewRequest request = new GetCampaignAudienceViewRequest
            {
                ResourceNameAsCampaignAudienceViewName = gagvr::CampaignAudienceViewName.FromCustomerCampaignAudienceView("[CUSTOMER]", "[CAMPAIGN_AUDIENCE_VIEW]"),
            };
            gagvr::CampaignAudienceView expectedResponse = new gagvr::CampaignAudienceView
            {
                ResourceNameAsCampaignAudienceViewName = gagvr::CampaignAudienceViewName.FromCustomerCampaignAudienceView("[CUSTOMER]", "[CAMPAIGN_AUDIENCE_VIEW]"),
            };

            mockGrpcClient.Setup(x => x.GetCampaignAudienceView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CampaignAudienceViewServiceClient client   = new CampaignAudienceViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignAudienceView       response = client.GetCampaignAudienceView(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetCampaignAudienceView2()
        {
            Mock <CampaignAudienceViewService.CampaignAudienceViewServiceClient> mockGrpcClient = new Mock <CampaignAudienceViewService.CampaignAudienceViewServiceClient>(MockBehavior.Strict);
            GetCampaignAudienceViewRequest request = new GetCampaignAudienceViewRequest
            {
                ResourceName = new CampaignAudienceViewName("[CUSTOMER]", "[CAMPAIGN_AUDIENCE_VIEW]").ToString(),
            };
            CampaignAudienceView expectedResponse = new CampaignAudienceView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignAudienceView(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CampaignAudienceViewServiceClient client = new CampaignAudienceViewServiceClientImpl(mockGrpcClient.Object, null);
            CampaignAudienceView response            = client.GetCampaignAudienceView(request);

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