public void GetProductGroupView() { moq::Mock <ProductGroupViewService.ProductGroupViewServiceClient> mockGrpcClient = new moq::Mock <ProductGroupViewService.ProductGroupViewServiceClient>(moq::MockBehavior.Strict); GetProductGroupViewRequest request = new GetProductGroupViewRequest { ResourceNameAsProductGroupViewName = gagvr::ProductGroupViewName.FromCustomerAdgroupCriterion("[CUSTOMER_ID]", "[ADGROUP_ID]", "[CRITERION_ID]"), }; gagvr::ProductGroupView expectedResponse = new gagvr::ProductGroupView { ResourceNameAsProductGroupViewName = gagvr::ProductGroupViewName.FromCustomerAdgroupCriterion("[CUSTOMER_ID]", "[ADGROUP_ID]", "[CRITERION_ID]"), }; mockGrpcClient.Setup(x => x.GetProductGroupView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ProductGroupViewServiceClient client = new ProductGroupViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::ProductGroupView response = client.GetProductGroupView(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetProductGroupView() { moq::Mock <ProductGroupViewService.ProductGroupViewServiceClient> mockGrpcClient = new moq::Mock <ProductGroupViewService.ProductGroupViewServiceClient>(moq::MockBehavior.Strict); GetProductGroupViewRequest request = new GetProductGroupViewRequest { ResourceNameAsProductGroupViewName = gagvr::ProductGroupViewName.FromCustomerProductGroupView("[CUSTOMER]", "[PRODUCT_GROUP_VIEW]"), }; gagvr::ProductGroupView expectedResponse = new gagvr::ProductGroupView { ResourceNameAsProductGroupViewName = gagvr::ProductGroupViewName.FromCustomerProductGroupView("[CUSTOMER]", "[PRODUCT_GROUP_VIEW]"), }; mockGrpcClient.Setup(x => x.GetProductGroupView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ProductGroupViewServiceClient client = new ProductGroupViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::ProductGroupView response = client.GetProductGroupView(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetProductGroupView2() { Mock <ProductGroupViewService.ProductGroupViewServiceClient> mockGrpcClient = new Mock <ProductGroupViewService.ProductGroupViewServiceClient>(MockBehavior.Strict); GetProductGroupViewRequest request = new GetProductGroupViewRequest { ResourceName = new ProductGroupViewName("[CUSTOMER]", "[PRODUCT_GROUP_VIEW]").ToString(), }; ProductGroupView expectedResponse = new ProductGroupView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetProductGroupView(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ProductGroupViewServiceClient client = new ProductGroupViewServiceClientImpl(mockGrpcClient.Object, null); ProductGroupView response = client.GetProductGroupView(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }