예제 #1
0
        public void MutateFeedItemTargets()
        {
            moq::Mock <FeedItemTargetService.FeedItemTargetServiceClient> mockGrpcClient = new moq::Mock <FeedItemTargetService.FeedItemTargetServiceClient>(moq::MockBehavior.Strict);
            MutateFeedItemTargetsRequest request = new MutateFeedItemTargetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new FeedItemTargetOperation(),
                },
            };
            MutateFeedItemTargetsResponse expectedResponse = new MutateFeedItemTargetsResponse
            {
                Results =
                {
                    new MutateFeedItemTargetResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateFeedItemTargets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedItemTargetServiceClient   client   = new FeedItemTargetServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedItemTargetsResponse response = client.MutateFeedItemTargets(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #2
0
        public void MutateFeedItemTargetsRequestObject()
        {
            moq::Mock <FeedItemTargetService.FeedItemTargetServiceClient> mockGrpcClient = new moq::Mock <FeedItemTargetService.FeedItemTargetServiceClient>(moq::MockBehavior.Strict);
            MutateFeedItemTargetsRequest request = new MutateFeedItemTargetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new FeedItemTargetOperation(),
                },
                ValidateOnly        = true,
                PartialFailure      = false,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateFeedItemTargetsResponse expectedResponse = new MutateFeedItemTargetsResponse
            {
                Results =
                {
                    new MutateFeedItemTargetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateFeedItemTargets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedItemTargetServiceClient   client   = new FeedItemTargetServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedItemTargetsResponse response = client.MutateFeedItemTargets(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateFeedItemTargets2()
        {
            Mock <FeedItemTargetService.FeedItemTargetServiceClient> mockGrpcClient = new Mock <FeedItemTargetService.FeedItemTargetServiceClient>(MockBehavior.Strict);
            MutateFeedItemTargetsRequest request = new MutateFeedItemTargetsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateFeedItemTargetsResponse expectedResponse = new MutateFeedItemTargetsResponse();

            mockGrpcClient.Setup(x => x.MutateFeedItemTargets(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            FeedItemTargetServiceClient   client   = new FeedItemTargetServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedItemTargetsResponse response = client.MutateFeedItemTargets(request);

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