public void GetDistanceView2() { Mock <DistanceViewService.DistanceViewServiceClient> mockGrpcClient = new Mock <DistanceViewService.DistanceViewServiceClient>(MockBehavior.Strict); GetDistanceViewRequest request = new GetDistanceViewRequest { ResourceName = new DistanceViewName("[CUSTOMER]", "[DISTANCE_VIEW]").ToString(), }; DistanceView expectedResponse = new DistanceView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetDistanceView(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); DistanceViewServiceClient client = new DistanceViewServiceClientImpl(mockGrpcClient.Object, null); DistanceView response = client.GetDistanceView(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetDistanceView() { moq::Mock <DistanceViewService.DistanceViewServiceClient> mockGrpcClient = new moq::Mock <DistanceViewService.DistanceViewServiceClient>(moq::MockBehavior.Strict); GetDistanceViewRequest request = new GetDistanceViewRequest { ResourceNameAsDistanceViewName = gagvr::DistanceViewName.FromCustomerDistanceView("[CUSTOMER]", "[DISTANCE_VIEW]"), }; gagvr::DistanceView expectedResponse = new gagvr::DistanceView { ResourceNameAsDistanceViewName = gagvr::DistanceViewName.FromCustomerDistanceView("[CUSTOMER]", "[DISTANCE_VIEW]"), DistanceBucket = gagve::DistanceBucketEnum.Types.DistanceBucket.Within25Miles, MetricSystem = true, }; mockGrpcClient.Setup(x => x.GetDistanceView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DistanceViewServiceClient client = new DistanceViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::DistanceView response = client.GetDistanceView(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetDistanceViewRequestObject() { moq::Mock <DistanceViewService.DistanceViewServiceClient> mockGrpcClient = new moq::Mock <DistanceViewService.DistanceViewServiceClient>(moq::MockBehavior.Strict); GetDistanceViewRequest request = new GetDistanceViewRequest { ResourceNameAsDistanceViewName = gagvr::DistanceViewName.FromCustomerPlaceholderChainDistanceBucket("[CUSTOMER_ID]", "[PLACEHOLDER_CHAIN_ID]", "[DISTANCE_BUCKET]"), }; gagvr::DistanceView expectedResponse = new gagvr::DistanceView { ResourceNameAsDistanceViewName = gagvr::DistanceViewName.FromCustomerPlaceholderChainDistanceBucket("[CUSTOMER_ID]", "[PLACEHOLDER_CHAIN_ID]", "[DISTANCE_BUCKET]"), DistanceBucket = gagve::DistanceBucketEnum.Types.DistanceBucket.Within25Miles, MetricSystem = true, }; mockGrpcClient.Setup(x => x.GetDistanceView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DistanceViewServiceClient client = new DistanceViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::DistanceView response = client.GetDistanceView(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }