Exemplo n.º 1
0
        public void MutateCustomerAssets()
        {
            moq::Mock <CustomerAssetService.CustomerAssetServiceClient> mockGrpcClient = new moq::Mock <CustomerAssetService.CustomerAssetServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerAssetsRequest request = new MutateCustomerAssetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerAssetOperation(),
                },
            };
            MutateCustomerAssetsResponse expectedResponse = new MutateCustomerAssetsResponse
            {
                PartialFailureError = new gr::Status(),
                Results             =
                {
                    new MutateCustomerAssetResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateCustomerAssets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerAssetServiceClient   client   = new CustomerAssetServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerAssetsResponse response = client.MutateCustomerAssets(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
        public void MutateCustomerAssetsRequestObject()
        {
            moq::Mock <CustomerAssetService.CustomerAssetServiceClient> mockGrpcClient = new moq::Mock <CustomerAssetService.CustomerAssetServiceClient>(moq::MockBehavior.Strict);
            MutateCustomerAssetsRequest request = new MutateCustomerAssetsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomerAssetOperation(),
                },
                PartialFailure      = false,
                ValidateOnly        = true,
                ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly,
            };
            MutateCustomerAssetsResponse expectedResponse = new MutateCustomerAssetsResponse
            {
                PartialFailureError = new gr::Status(),
                Results             =
                {
                    new MutateCustomerAssetResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateCustomerAssets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomerAssetServiceClient   client   = new CustomerAssetServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomerAssetsResponse response = client.MutateCustomerAssets(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }