示例#1
0
        public void DismissRecommendation()
        {
            moq::Mock <RecommendationService.RecommendationServiceClient> mockGrpcClient = new moq::Mock <RecommendationService.RecommendationServiceClient>(moq::MockBehavior.Strict);
            DismissRecommendationRequest request = new DismissRecommendationRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new DismissRecommendationRequest.Types.DismissRecommendationOperation(),
                },
            };
            DismissRecommendationResponse expectedResponse = new DismissRecommendationResponse
            {
                Results =
                {
                    new DismissRecommendationResponse.Types.DismissRecommendationResult(),
                },
                PartialFailureError = new gr::Status(),
            };

            mockGrpcClient.Setup(x => x.DismissRecommendation(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            RecommendationServiceClient   client   = new RecommendationServiceClientImpl(mockGrpcClient.Object, null);
            DismissRecommendationResponse response = client.DismissRecommendation(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#2
0
        public void DismissRecommendation3()
        {
            Mock <RecommendationService.RecommendationServiceClient> mockGrpcClient = new Mock <RecommendationService.RecommendationServiceClient>(MockBehavior.Strict);
            DismissRecommendationRequest request = new DismissRecommendationRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            DismissRecommendationResponse expectedResponse = new DismissRecommendationResponse();

            mockGrpcClient.Setup(x => x.DismissRecommendation(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            RecommendationServiceClient   client   = new RecommendationServiceClientImpl(mockGrpcClient.Object, null);
            DismissRecommendationResponse response = client.DismissRecommendation(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void DismissRecommendation()
        {
            Mock <RecommendationService.RecommendationServiceClient> mockGrpcClient = new Mock <RecommendationService.RecommendationServiceClient>(MockBehavior.Strict);
            DismissRecommendationRequest expectedRequest = new DismissRecommendationRequest
            {
                CustomerId     = "customerId-1772061412",
                PartialFailure = true,
                Operations     = { },
            };
            DismissRecommendationResponse expectedResponse = new DismissRecommendationResponse();

            mockGrpcClient.Setup(x => x.DismissRecommendation(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            RecommendationServiceClient client = new RecommendationServiceClientImpl(mockGrpcClient.Object, null);
            string customerId     = "customerId-1772061412";
            bool   partialFailure = true;
            IEnumerable <DismissRecommendationRequest.Types.DismissRecommendationOperation> operations = new List <DismissRecommendationRequest.Types.DismissRecommendationOperation>();
            DismissRecommendationResponse response = client.DismissRecommendation(customerId, partialFailure, operations);

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