Ejemplo n.º 1
0
        public async stt::Task MutateCustomerLabelsAsync()
        {
            moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerLabelsRequest request = new MutateCustomerLabelsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerLabelOperation(),
                },
            };
            MutateCustomerLabelsResponse expectedResponse = new MutateCustomerLabelsResponse
            {
                Results =
                {
                    new MutateCustomerLabelResult(),
                },
                PartialFailureError = new gr::Status(),
            };

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

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateCustomerLabelsResponse responseCancellationToken = await client.MutateCustomerLabelsAsync(request.CustomerId, request.Operations, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public void MutateCustomerLabels()
        {
            moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerLabelsRequest request = new MutateCustomerLabelsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerLabelOperation(),
                },
            };
            MutateCustomerLabelsResponse expectedResponse = new MutateCustomerLabelsResponse
            {
                Results =
                {
                    new MutateCustomerLabelResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateCustomerLabels(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerLabelServiceClient   client   = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerLabelsResponse response = client.MutateCustomerLabels(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 3
0
        public async Task MutateCustomerLabelsAsync3()
        {
            Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict);
            MutateCustomerLabelsRequest request = new MutateCustomerLabelsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomerLabelsResponse expectedResponse = new MutateCustomerLabelsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerLabelsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCustomerLabelsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerLabelServiceClient   client   = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerLabelsResponse response = await client.MutateCustomerLabelsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 4
0
        public void MutateCustomerLabels3()
        {
            Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict);
            MutateCustomerLabelsRequest request = new MutateCustomerLabelsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomerLabelsResponse expectedResponse = new MutateCustomerLabelsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomerLabels(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerLabelServiceClient   client   = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerLabelsResponse response = client.MutateCustomerLabels(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 5
0
        public void GetCustomerLabel2()
        {
            Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict);
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceName = new CustomerLabelName("[CUSTOMER]", "[CUSTOMER_LABEL]").ToString(),
            };
            CustomerLabel expectedResponse = new CustomerLabel
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerLabel(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            CustomerLabel response            = client.GetCustomerLabel(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 6
0
        public async Task GetCustomerLabelAsync2()
        {
            Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict);
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceName = new CustomerLabelName("[CUSTOMER]", "[CUSTOMER_LABEL]").ToString(),
            };
            CustomerLabel expectedResponse = new CustomerLabel
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerLabelAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CustomerLabel>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            CustomerLabel response            = await client.GetCustomerLabelAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 7
0
        public void GetCustomerLabel()
        {
            moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict);
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"),
            };
            gagvr::CustomerLabel expectedResponse = new gagvr::CustomerLabel
            {
                ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"),
                Customer = "customer931fec91",
                Label    = "label20ba04d3",
            };

            mockGrpcClient.Setup(x => x.GetCustomerLabel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerLabelServiceClient client   = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CustomerLabel       response = client.GetCustomerLabel(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 8
0
        public void GetCustomerLabelRequestObject()
        {
            moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict);
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"),
            };
            gagvr::CustomerLabel expectedResponse = new gagvr::CustomerLabel
            {
                ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"),
                CustomerAsCustomerName          = gagvr::CustomerName.FromCustomer("[CUSTOMER]"),
                LabelAsLabelName = gagvr::LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"),
            };

            mockGrpcClient.Setup(x => x.GetCustomerLabel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerLabelServiceClient client   = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CustomerLabel       response = client.GetCustomerLabel(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 9
0
        public async stt::Task GetCustomerLabelRequestObjectAsync()
        {
            moq::Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new moq::Mock <CustomerLabelService.CustomerLabelServiceClient>(moq::MockBehavior.Strict);
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"),
            };
            gagvr::CustomerLabel expectedResponse = new gagvr::CustomerLabel
            {
                ResourceNameAsCustomerLabelName = gagvr::CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"),
                Customer = "customer931fec91",
                Label    = "label20ba04d3",
            };

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

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::CustomerLabel responseCancellationToken = await client.GetCustomerLabelAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 10
0
        public async Task MutateCustomerLabelsAsync()
        {
            Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict);
            MutateCustomerLabelsRequest expectedRequest = new MutateCustomerLabelsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateCustomerLabelsResponse expectedResponse = new MutateCustomerLabelsResponse();

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

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