Ejemplo n.º 1
0
        public void GetAdGroupAudienceView()
        {
            moq::Mock <AdGroupAudienceViewService.AdGroupAudienceViewServiceClient> mockGrpcClient = new moq::Mock <AdGroupAudienceViewService.AdGroupAudienceViewServiceClient>(moq::MockBehavior.Strict);
            GetAdGroupAudienceViewRequest request = new GetAdGroupAudienceViewRequest
            {
                ResourceNameAsAdGroupAudienceViewName = gagvr::AdGroupAudienceViewName.FromCustomerAdGroupAudienceView("[CUSTOMER]", "[AD_GROUP_AUDIENCE_VIEW]"),
            };
            gagvr::AdGroupAudienceView expectedResponse = new gagvr::AdGroupAudienceView
            {
                ResourceNameAsAdGroupAudienceViewName = gagvr::AdGroupAudienceViewName.FromCustomerAdGroupAudienceView("[CUSTOMER]", "[AD_GROUP_AUDIENCE_VIEW]"),
            };

            mockGrpcClient.Setup(x => x.GetAdGroupAudienceView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AdGroupAudienceViewServiceClient client   = new AdGroupAudienceViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::AdGroupAudienceView       response = client.GetAdGroupAudienceView(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetAdGroupAudienceView2()
        {
            Mock <AdGroupAudienceViewService.AdGroupAudienceViewServiceClient> mockGrpcClient = new Mock <AdGroupAudienceViewService.AdGroupAudienceViewServiceClient>(MockBehavior.Strict);
            GetAdGroupAudienceViewRequest request = new GetAdGroupAudienceViewRequest
            {
                ResourceName = new AdGroupAudienceViewName("[CUSTOMER]", "[AD_GROUP_AUDIENCE_VIEW]").ToString(),
            };
            AdGroupAudienceView expectedResponse = new AdGroupAudienceView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAdGroupAudienceView(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AdGroupAudienceViewServiceClient client = new AdGroupAudienceViewServiceClientImpl(mockGrpcClient.Object, null);
            AdGroupAudienceView response            = client.GetAdGroupAudienceView(request);

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