public void GetLocationView() { moq::Mock <LocationViewService.LocationViewServiceClient> mockGrpcClient = new moq::Mock <LocationViewService.LocationViewServiceClient>(moq::MockBehavior.Strict); GetLocationViewRequest request = new GetLocationViewRequest { ResourceNameAsLocationViewName = gagvr::LocationViewName.FromCustomerLocationView("[CUSTOMER]", "[LOCATION_VIEW]"), }; gagvr::LocationView expectedResponse = new gagvr::LocationView { ResourceNameAsLocationViewName = gagvr::LocationViewName.FromCustomerLocationView("[CUSTOMER]", "[LOCATION_VIEW]"), }; mockGrpcClient.Setup(x => x.GetLocationView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LocationViewServiceClient client = new LocationViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::LocationView response = client.GetLocationView(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetLocationView() { moq::Mock <LocationViewService.LocationViewServiceClient> mockGrpcClient = new moq::Mock <LocationViewService.LocationViewServiceClient>(moq::MockBehavior.Strict); GetLocationViewRequest request = new GetLocationViewRequest { ResourceNameAsLocationViewName = gagvr::LocationViewName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"), }; gagvr::LocationView expectedResponse = new gagvr::LocationView { ResourceNameAsLocationViewName = gagvr::LocationViewName.FromCustomerCampaignCriterion("[CUSTOMER_ID]", "[CAMPAIGN_ID]", "[CRITERION_ID]"), }; mockGrpcClient.Setup(x => x.GetLocationView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LocationViewServiceClient client = new LocationViewServiceClientImpl(mockGrpcClient.Object, null); gagvr::LocationView response = client.GetLocationView(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetLocationView2() { Mock <LocationViewService.LocationViewServiceClient> mockGrpcClient = new Mock <LocationViewService.LocationViewServiceClient>(MockBehavior.Strict); GetLocationViewRequest request = new GetLocationViewRequest { ResourceName = new LocationViewName("[CUSTOMER]", "[LOCATION_VIEW]").ToString(), }; LocationView expectedResponse = new LocationView { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetLocationView(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); LocationViewServiceClient client = new LocationViewServiceClientImpl(mockGrpcClient.Object, null); LocationView response = client.GetLocationView(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }