Esempio n. 1
0
        public async Task GetGeographicViewAsync2()
        {
            Mock <GeographicViewService.GeographicViewServiceClient> mockGrpcClient = new Mock <GeographicViewService.GeographicViewServiceClient>(MockBehavior.Strict);
            GetGeographicViewRequest request = new GetGeographicViewRequest
            {
                ResourceName = new GeographicViewName("[CUSTOMER]", "[GEOGRAPHIC_VIEW]").ToString(),
            };
            GeographicView expectedResponse = new GeographicView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetGeographicViewAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <GeographicView>(Task.FromResult(expectedResponse), null, null, null, null));
            GeographicViewServiceClient client = new GeographicViewServiceClientImpl(mockGrpcClient.Object, null);
            GeographicView response            = await client.GetGeographicViewAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 2
0
        public void GetGeographicView2()
        {
            Mock <GeographicViewService.GeographicViewServiceClient> mockGrpcClient = new Mock <GeographicViewService.GeographicViewServiceClient>(MockBehavior.Strict);
            GetGeographicViewRequest request = new GetGeographicViewRequest
            {
                ResourceName = new GeographicViewName("[CUSTOMER]", "[GEOGRAPHIC_VIEW]").ToString(),
            };
            GeographicView expectedResponse = new GeographicView
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetGeographicView(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            GeographicViewServiceClient client = new GeographicViewServiceClientImpl(mockGrpcClient.Object, null);
            GeographicView response            = client.GetGeographicView(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 3
0
        public void GetGeographicView()
        {
            moq::Mock <GeographicViewService.GeographicViewServiceClient> mockGrpcClient = new moq::Mock <GeographicViewService.GeographicViewServiceClient>(moq::MockBehavior.Strict);
            GetGeographicViewRequest request = new GetGeographicViewRequest
            {
                ResourceNameAsGeographicViewName = gagvr::GeographicViewName.FromCustomerCountryCriterionLocationType("[CUSTOMER_ID]", "[COUNTRY_CRITERION_ID]", "[LOCATION_TYPE]"),
            };
            gagvr::GeographicView expectedResponse = new gagvr::GeographicView
            {
                ResourceNameAsGeographicViewName = gagvr::GeographicViewName.FromCustomerCountryCriterionLocationType("[CUSTOMER_ID]", "[COUNTRY_CRITERION_ID]", "[LOCATION_TYPE]"),
                LocationType       = gagve::GeoTargetingTypeEnum.Types.GeoTargetingType.LocationOfPresence,
                CountryCriterionId = 7801114990940938649L,
            };

            mockGrpcClient.Setup(x => x.GetGeographicView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GeographicViewServiceClient client   = new GeographicViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::GeographicView       response = client.GetGeographicView(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetGeographicViewRequestObject()
        {
            moq::Mock <GeographicViewService.GeographicViewServiceClient> mockGrpcClient = new moq::Mock <GeographicViewService.GeographicViewServiceClient>(moq::MockBehavior.Strict);
            GetGeographicViewRequest request = new GetGeographicViewRequest
            {
                ResourceNameAsGeographicViewName = gagvr::GeographicViewName.FromCustomerGeographicView("[CUSTOMER]", "[GEOGRAPHIC_VIEW]"),
            };
            gagvr::GeographicView expectedResponse = new gagvr::GeographicView
            {
                ResourceNameAsGeographicViewName = gagvr::GeographicViewName.FromCustomerGeographicView("[CUSTOMER]", "[GEOGRAPHIC_VIEW]"),
                LocationType       = gagve::GeoTargetingTypeEnum.Types.GeoTargetingType.LocationOfPresence,
                CountryCriterionId = 7801114990940938649L,
            };

            mockGrpcClient.Setup(x => x.GetGeographicView(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GeographicViewServiceClient client   = new GeographicViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::GeographicView       response = client.GetGeographicView(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 5
0
        public async stt::Task GetGeographicViewRequestObjectAsync()
        {
            moq::Mock <GeographicViewService.GeographicViewServiceClient> mockGrpcClient = new moq::Mock <GeographicViewService.GeographicViewServiceClient>(moq::MockBehavior.Strict);
            GetGeographicViewRequest request = new GetGeographicViewRequest
            {
                ResourceNameAsGeographicViewName = gagvr::GeographicViewName.FromCustomerCountryCriterionLocationType("[CUSTOMER_ID]", "[COUNTRY_CRITERION_ID]", "[LOCATION_TYPE]"),
            };
            gagvr::GeographicView expectedResponse = new gagvr::GeographicView
            {
                ResourceNameAsGeographicViewName = gagvr::GeographicViewName.FromCustomerCountryCriterionLocationType("[CUSTOMER_ID]", "[COUNTRY_CRITERION_ID]", "[LOCATION_TYPE]"),
                LocationType       = gagve::GeoTargetingTypeEnum.Types.GeoTargetingType.LocationOfPresence,
                CountryCriterionId = 7801114990940938649L,
            };

            mockGrpcClient.Setup(x => x.GetGeographicViewAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::GeographicView>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            GeographicViewServiceClient client = new GeographicViewServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::GeographicView       responseCallSettings = await client.GetGeographicViewAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::GeographicView responseCancellationToken = await client.GetGeographicViewAsync(request, st::CancellationToken.None);

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