コード例 #1
0
        public void MutateSharedSets()
        {
            moq::Mock <SharedSetService.SharedSetServiceClient> mockGrpcClient = new moq::Mock <SharedSetService.SharedSetServiceClient>(moq::MockBehavior.Strict);
            MutateSharedSetsRequest request = new MutateSharedSetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new SharedSetOperation(),
                },
            };
            MutateSharedSetsResponse expectedResponse = new MutateSharedSetsResponse
            {
                Results =
                {
                    new MutateSharedSetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateSharedSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SharedSetServiceClient   client   = new SharedSetServiceClientImpl(mockGrpcClient.Object, null);
            MutateSharedSetsResponse response = client.MutateSharedSets(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public void MutateSharedSetsRequestObject()
        {
            moq::Mock <SharedSetService.SharedSetServiceClient> mockGrpcClient = new moq::Mock <SharedSetService.SharedSetServiceClient>(moq::MockBehavior.Strict);
            MutateSharedSetsRequest request = new MutateSharedSetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new SharedSetOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateSharedSetsResponse expectedResponse = new MutateSharedSetsResponse
            {
                Results =
                {
                    new MutateSharedSetResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.MutateSharedSets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SharedSetServiceClient   client   = new SharedSetServiceClientImpl(mockGrpcClient.Object, null);
            MutateSharedSetsResponse response = client.MutateSharedSets(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
        public void MutateSharedSets3()
        {
            Mock <SharedSetService.SharedSetServiceClient> mockGrpcClient = new Mock <SharedSetService.SharedSetServiceClient>(MockBehavior.Strict);
            MutateSharedSetsRequest request = new MutateSharedSetsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateSharedSetsResponse expectedResponse = new MutateSharedSetsResponse();

            mockGrpcClient.Setup(x => x.MutateSharedSets(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SharedSetServiceClient   client   = new SharedSetServiceClientImpl(mockGrpcClient.Object, null);
            MutateSharedSetsResponse response = client.MutateSharedSets(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public void MutateSharedSets()
        {
            Mock <SharedSetService.SharedSetServiceClient> mockGrpcClient = new Mock <SharedSetService.SharedSetServiceClient>(MockBehavior.Strict);
            MutateSharedSetsRequest expectedRequest = new MutateSharedSetsRequest
            {
                CustomerId     = "customerId-1772061412",
                Operations     = { },
                PartialFailure = true,
                ValidateOnly   = false,
            };
            MutateSharedSetsResponse expectedResponse = new MutateSharedSetsResponse();

            mockGrpcClient.Setup(x => x.MutateSharedSets(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SharedSetServiceClient client = new SharedSetServiceClientImpl(mockGrpcClient.Object, null);
            string customerId             = "customerId-1772061412";
            IEnumerable <SharedSetOperation> operations = new List <SharedSetOperation>();
            bool partialFailure = true;
            bool validateOnly   = false;
            MutateSharedSetsResponse response = client.MutateSharedSets(customerId, operations, partialFailure, validateOnly);

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