Exemplo n.º 1
0
        public void MutateKeywordPlans()
        {
            moq::Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new moq::Mock <KeywordPlanService.KeywordPlanServiceClient>(moq::MockBehavior.Strict);
            MutateKeywordPlansRequest request = new MutateKeywordPlansRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new KeywordPlanOperation(),
                },
            };
            MutateKeywordPlansResponse expectedResponse = new MutateKeywordPlansResponse
            {
                Results =
                {
                    new MutateKeywordPlansResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateKeywordPlans(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            KeywordPlanServiceClient   client   = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null);
            MutateKeywordPlansResponse response = client.MutateKeywordPlans(request.CustomerId, request.Operations);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateKeywordPlans3()
        {
            Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new Mock <KeywordPlanService.KeywordPlanServiceClient>(MockBehavior.Strict);
            MutateKeywordPlansRequest request = new MutateKeywordPlansRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateKeywordPlansResponse expectedResponse = new MutateKeywordPlansResponse();

            mockGrpcClient.Setup(x => x.MutateKeywordPlans(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            KeywordPlanServiceClient   client   = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null);
            MutateKeywordPlansResponse response = client.MutateKeywordPlans(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateKeywordPlans()
        {
            Mock <KeywordPlanService.KeywordPlanServiceClient> mockGrpcClient = new Mock <KeywordPlanService.KeywordPlanServiceClient>(MockBehavior.Strict);
            MutateKeywordPlansRequest expectedRequest = new MutateKeywordPlansRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateKeywordPlansResponse expectedResponse = new MutateKeywordPlansResponse();

            mockGrpcClient.Setup(x => x.MutateKeywordPlans(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            KeywordPlanServiceClient client = new KeywordPlanServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            IEnumerable <KeywordPlanOperation> operations = new List <KeywordPlanOperation>();
            bool partialFailure = true;
            bool validateOnly   = false;
            MutateKeywordPlansResponse response = client.MutateKeywordPlans(customerId, operations, partialFailure, validateOnly);

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