public async stt::Task MutateFeedsAsync()
        {
            moq::Mock <FeedService.FeedServiceClient> mockGrpcClient = new moq::Mock <FeedService.FeedServiceClient>(moq::MockBehavior.Strict);
            MutateFeedsRequest request = new MutateFeedsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new FeedOperation(),
                },
            };
            MutateFeedsResponse expectedResponse = new MutateFeedsResponse
            {
                Results =
                {
                    new MutateFeedResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateFeedsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateFeedsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            FeedServiceClient   client = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedsResponse responseCallSettings = await client.MutateFeedsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            MutateFeedsResponse responseCancellationToken = await client.MutateFeedsAsync(request.CustomerId, request.Operations, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetFeedRequestObject()
        {
            moq::Mock <FeedService.FeedServiceClient> mockGrpcClient = new moq::Mock <FeedService.FeedServiceClient>(moq::MockBehavior.Strict);
            GetFeedRequest request = new GetFeedRequest
            {
                ResourceNameAsFeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"),
            };
            gagvr::Feed expectedResponse = new gagvr::Feed
            {
                ResourceNameAsFeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"),
                Attributes             =
                {
                    new gagvr::FeedAttribute(),
                },
                Origin = gagve::FeedOriginEnum.Types.FeedOrigin.Unspecified,
                PlacesLocationFeedData    = new gagvr::Feed.Types.PlacesLocationFeedData(),
                AffiliateLocationFeedData = new gagvr::Feed.Types.AffiliateLocationFeedData(),
                Status = gagve::FeedStatusEnum.Types.FeedStatus.Enabled,
                AttributeOperations =
                {
                    new gagvr::FeedAttributeOperation(),
                },
                Id       = -6774108720365892680L,
                FeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"),
            };

            mockGrpcClient.Setup(x => x.GetFeed(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedServiceClient client   = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::Feed       response = client.GetFeed(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateFeeds()
        {
            moq::Mock <FeedService.FeedServiceClient> mockGrpcClient = new moq::Mock <FeedService.FeedServiceClient>(moq::MockBehavior.Strict);
            MutateFeedsRequest request = new MutateFeedsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new FeedOperation(),
                },
            };
            MutateFeedsResponse expectedResponse = new MutateFeedsResponse
            {
                Results =
                {
                    new MutateFeedResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateFeeds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedServiceClient   client   = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedsResponse response = client.MutateFeeds(request.CustomerId, request.Operations);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateFeedsRequestObject()
        {
            moq::Mock <FeedService.FeedServiceClient> mockGrpcClient = new moq::Mock <FeedService.FeedServiceClient>(moq::MockBehavior.Strict);
            MutateFeedsRequest request = new MutateFeedsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new FeedOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateFeedsResponse expectedResponse = new MutateFeedsResponse
            {
                Results =
                {
                    new MutateFeedResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateFeeds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FeedServiceClient   client   = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedsResponse response = client.MutateFeeds(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #5
0
        public async Task MutateFeedsAsync2()
        {
            Mock <FeedService.FeedServiceClient> mockGrpcClient = new Mock <FeedService.FeedServiceClient>(MockBehavior.Strict);
            MutateFeedsRequest request = new MutateFeedsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateFeedsResponse expectedResponse = new MutateFeedsResponse();

            mockGrpcClient.Setup(x => x.MutateFeedsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateFeedsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            FeedServiceClient   client   = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedsResponse response = await client.MutateFeedsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #6
0
        public void MutateFeeds2()
        {
            Mock <FeedService.FeedServiceClient> mockGrpcClient = new Mock <FeedService.FeedServiceClient>(MockBehavior.Strict);
            MutateFeedsRequest request = new MutateFeedsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateFeedsResponse expectedResponse = new MutateFeedsResponse();

            mockGrpcClient.Setup(x => x.MutateFeeds(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            FeedServiceClient   client   = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            MutateFeedsResponse response = client.MutateFeeds(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #7
0
        public void GetFeed2()
        {
            Mock <FeedService.FeedServiceClient> mockGrpcClient = new Mock <FeedService.FeedServiceClient>(MockBehavior.Strict);
            GetFeedRequest request = new GetFeedRequest
            {
                ResourceName = new FeedName("[CUSTOMER]", "[FEED]").ToString(),
            };
            Feed expectedResponse = new Feed
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetFeed(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            FeedServiceClient client = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            Feed response            = client.GetFeed(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #8
0
        public async Task GetFeedAsync2()
        {
            Mock <FeedService.FeedServiceClient> mockGrpcClient = new Mock <FeedService.FeedServiceClient>(MockBehavior.Strict);
            GetFeedRequest request = new GetFeedRequest
            {
                ResourceName = new FeedName("[CUSTOMER]", "[FEED]").ToString(),
            };
            Feed expectedResponse = new Feed
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetFeedAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Feed>(Task.FromResult(expectedResponse), null, null, null, null));
            FeedServiceClient client = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            Feed response            = await client.GetFeedAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task GetFeedRequestObjectAsync()
        {
            moq::Mock <FeedService.FeedServiceClient> mockGrpcClient = new moq::Mock <FeedService.FeedServiceClient>(moq::MockBehavior.Strict);
            GetFeedRequest request = new GetFeedRequest
            {
                ResourceNameAsFeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"),
            };
            gagvr::Feed expectedResponse = new gagvr::Feed
            {
                ResourceNameAsFeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"),
                Attributes             =
                {
                    new gagvr::FeedAttribute(),
                },
                Origin = gagve::FeedOriginEnum.Types.FeedOrigin.Unspecified,
                PlacesLocationFeedData    = new gagvr::Feed.Types.PlacesLocationFeedData(),
                AffiliateLocationFeedData = new gagvr::Feed.Types.AffiliateLocationFeedData(),
                Status = gagve::FeedStatusEnum.Types.FeedStatus.Enabled,
                AttributeOperations =
                {
                    new gagvr::FeedAttributeOperation(),
                },
                Id       = -6774108720365892680L,
                FeedName = gagvr::FeedName.FromCustomerFeed("[CUSTOMER_ID]", "[FEED_ID]"),
            };

            mockGrpcClient.Setup(x => x.GetFeedAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::Feed>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            FeedServiceClient client = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::Feed       responseCallSettings = await client.GetFeedAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::Feed responseCancellationToken = await client.GetFeedAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #10
0
        public async Task MutateFeedsAsync()
        {
            Mock <FeedService.FeedServiceClient> mockGrpcClient = new Mock <FeedService.FeedServiceClient>(MockBehavior.Strict);
            MutateFeedsRequest expectedRequest = new MutateFeedsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateFeedsResponse expectedResponse = new MutateFeedsResponse();

            mockGrpcClient.Setup(x => x.MutateFeedsAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateFeedsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            FeedServiceClient           client     = new FeedServiceClientImpl(mockGrpcClient.Object, null);
            string                      customerId = "customerId-1772061412";
            IEnumerable <FeedOperation> operations = new List <FeedOperation>();
            bool partialFailure          = true;
            bool validateOnly            = false;
            MutateFeedsResponse response = await client.MutateFeedsAsync(customerId, operations, partialFailure, validateOnly);

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