Exemplo n.º 1
0
        public void GetAdScheduleView()
        {
            moq::Mock <AdScheduleViewService.AdScheduleViewServiceClient> mockGrpcClient = new moq::Mock <AdScheduleViewService.AdScheduleViewServiceClient>(moq::MockBehavior.Strict);
            GetAdScheduleViewRequest request = new GetAdScheduleViewRequest
            {
                ResourceNameAsAdScheduleViewName = gagvr::AdScheduleViewName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"),
            };
            gagvr::AdScheduleView expectedResponse = new gagvr::AdScheduleView
            {
                ResourceNameAsAdScheduleViewName = gagvr::AdScheduleViewName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"),
            };

            mockGrpcClient.Setup(x => x.GetAdScheduleView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AdScheduleViewServiceClient client   = new AdScheduleViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::AdScheduleView       response = client.GetAdScheduleView(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
        public void GetAdScheduleView()
        {
            moq::Mock <AdScheduleViewService.AdScheduleViewServiceClient> mockGrpcClient = new moq::Mock <AdScheduleViewService.AdScheduleViewServiceClient>(moq::MockBehavior.Strict);
            GetAdScheduleViewRequest request = new GetAdScheduleViewRequest
            {
                ResourceNameAsAdScheduleViewName = gagvr::AdScheduleViewName.FromCustomerAdScheduleView("[CUSTOMER]", "[AD_SCHEDULE_VIEW]"),
            };
            gagvr::AdScheduleView expectedResponse = new gagvr::AdScheduleView
            {
                ResourceNameAsAdScheduleViewName = gagvr::AdScheduleViewName.FromCustomerAdScheduleView("[CUSTOMER]", "[AD_SCHEDULE_VIEW]"),
            };

            mockGrpcClient.Setup(x => x.GetAdScheduleView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AdScheduleViewServiceClient client   = new AdScheduleViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::AdScheduleView       response = client.GetAdScheduleView(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetAdScheduleView2()
        {
            Mock <AdScheduleViewService.AdScheduleViewServiceClient> mockGrpcClient = new Mock <AdScheduleViewService.AdScheduleViewServiceClient>(MockBehavior.Strict);
            GetAdScheduleViewRequest request = new GetAdScheduleViewRequest
            {
                ResourceName = new AdScheduleViewName("[CUSTOMER]", "[AD_SCHEDULE_VIEW]").ToString(),
            };
            AdScheduleView expectedResponse = new AdScheduleView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAdScheduleView(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AdScheduleViewServiceClient client = new AdScheduleViewServiceClientImpl(mockGrpcClient.Object, null);
            AdScheduleView response            = client.GetAdScheduleView(request);

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