Пример #1
0
        public void MutateCustomerNegativeCriteria()
        {
            moq::Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient> mockGrpcClient = new moq::Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerNegativeCriteriaRequest request = new MutateCustomerNegativeCriteriaRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerNegativeCriterionOperation(),
                },
            };
            MutateCustomerNegativeCriteriaResponse expectedResponse = new MutateCustomerNegativeCriteriaResponse
            {
                Results =
                {
                    new MutateCustomerNegativeCriteriaResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerNegativeCriteria(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerNegativeCriterionServiceClient client   = new CustomerNegativeCriterionServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerNegativeCriteriaResponse response = client.MutateCustomerNegativeCriteria(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCustomerNegativeCriteriaRequestObject()
        {
            moq::Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient> mockGrpcClient = new moq::Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerNegativeCriteriaRequest request = new MutateCustomerNegativeCriteriaRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerNegativeCriterionOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateCustomerNegativeCriteriaResponse expectedResponse = new MutateCustomerNegativeCriteriaResponse
            {
                Results =
                {
                    new MutateCustomerNegativeCriteriaResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerNegativeCriteria(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerNegativeCriterionServiceClient client   = new CustomerNegativeCriterionServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerNegativeCriteriaResponse response = client.MutateCustomerNegativeCriteria(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCustomerNegativeCriteria3()
        {
            Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient> mockGrpcClient = new Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient>(MockBehavior.Strict);
            MutateCustomerNegativeCriteriaRequest request = new MutateCustomerNegativeCriteriaRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomerNegativeCriteriaResponse expectedResponse = new MutateCustomerNegativeCriteriaResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerNegativeCriteria(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerNegativeCriterionServiceClient client   = new CustomerNegativeCriterionServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerNegativeCriteriaResponse response = client.MutateCustomerNegativeCriteria(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void MutateCustomerNegativeCriteria()
        {
            Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient> mockGrpcClient = new Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient>(MockBehavior.Strict);
            MutateCustomerNegativeCriteriaRequest expectedRequest = new MutateCustomerNegativeCriteriaRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateCustomerNegativeCriteriaResponse expectedResponse = new MutateCustomerNegativeCriteriaResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerNegativeCriteria(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerNegativeCriterionServiceClient client = new CustomerNegativeCriterionServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            IEnumerable <CustomerNegativeCriterionOperation> operations = new List <CustomerNegativeCriterionOperation>();
            bool partialFailure = true;
            bool validateOnly   = false;
            MutateCustomerNegativeCriteriaResponse response = client.MutateCustomerNegativeCriteria(customerId, operations, partialFailure, validateOnly);

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