示例#1
0
        public void MutateFeedMappings()
        {
            moq::Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new moq::Mock <FeedMappingService.FeedMappingServiceClient>(moq::MockBehavior.Strict);
            MutateFeedMappingsRequest request = new MutateFeedMappingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new FeedMappingOperation(),
                },
            };
            MutateFeedMappingsResponse expectedResponse = new MutateFeedMappingsResponse
            {
                Results =
                {
                    new MutateFeedMappingResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateFeedMappings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedMappingServiceClient   client   = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedMappingsResponse response = client.MutateFeedMappings(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateFeedMappingsRequestObject()
        {
            moq::Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new moq::Mock <FeedMappingService.FeedMappingServiceClient>(moq::MockBehavior.Strict);
            MutateFeedMappingsRequest request = new MutateFeedMappingsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new FeedMappingOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateFeedMappingsResponse expectedResponse = new MutateFeedMappingsResponse
            {
                Results =
                {
                    new MutateFeedMappingResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateFeedMappings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedMappingServiceClient   client   = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedMappingsResponse response = client.MutateFeedMappings(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#3
0
        public void MutateFeedMappings3()
        {
            Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new Mock <FeedMappingService.FeedMappingServiceClient>(MockBehavior.Strict);
            MutateFeedMappingsRequest request = new MutateFeedMappingsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateFeedMappingsResponse expectedResponse = new MutateFeedMappingsResponse();

            mockGrpcClient.Setup(x => x.MutateFeedMappings(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            FeedMappingServiceClient   client   = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedMappingsResponse response = client.MutateFeedMappings(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#4
0
        public void MutateFeedMappings()
        {
            Mock <FeedMappingService.FeedMappingServiceClient> mockGrpcClient = new Mock <FeedMappingService.FeedMappingServiceClient>(MockBehavior.Strict);
            MutateFeedMappingsRequest expectedRequest = new MutateFeedMappingsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateFeedMappingsResponse expectedResponse = new MutateFeedMappingsResponse();

            mockGrpcClient.Setup(x => x.MutateFeedMappings(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            FeedMappingServiceClient client = new FeedMappingServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            IEnumerable <FeedMappingOperation> operations = new List <FeedMappingOperation>();
            bool partialFailure = true;
            bool validateOnly   = false;
            MutateFeedMappingsResponse response = client.MutateFeedMappings(customerId, operations, partialFailure, validateOnly);

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