Beispiel #1
0
        public void GetShoppingPerformanceView()
        {
            moq::Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient> mockGrpcClient = new moq::Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient>(moq::MockBehavior.Strict);
            GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest
            {
                ResourceNameAsShoppingPerformanceViewName = gagvr::ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"),
            };
            gagvr::ShoppingPerformanceView expectedResponse = new gagvr::ShoppingPerformanceView
            {
                ResourceNameAsShoppingPerformanceViewName = gagvr::ShoppingPerformanceViewName.FromCustomer("[CUSTOMER]"),
            };

            mockGrpcClient.Setup(x => x.GetShoppingPerformanceView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ShoppingPerformanceViewServiceClient client   = new ShoppingPerformanceViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::ShoppingPerformanceView       response = client.GetShoppingPerformanceView(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetShoppingPerformanceView2()
        {
            Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient> mockGrpcClient = new Mock <ShoppingPerformanceViewService.ShoppingPerformanceViewServiceClient>(MockBehavior.Strict);
            GetShoppingPerformanceViewRequest request = new GetShoppingPerformanceViewRequest
            {
                ResourceName = new ShoppingPerformanceViewName("[CUSTOMER]").ToString(),
            };
            ShoppingPerformanceView expectedResponse = new ShoppingPerformanceView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetShoppingPerformanceView(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ShoppingPerformanceViewServiceClient client = new ShoppingPerformanceViewServiceClientImpl(mockGrpcClient.Object, null);
            ShoppingPerformanceView response            = client.GetShoppingPerformanceView(request);

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