Пример #1
0
 /// <summary>Snippet for GetGeographicView</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGeographicViewRequestObject()
 {
     // Create client
     GeographicViewServiceClient geographicViewServiceClient = GeographicViewServiceClient.Create();
     // Initialize request argument(s)
     GetGeographicViewRequest request = new GetGeographicViewRequest
     {
         ResourceNameAsGeographicViewName = GeographicViewName.FromCustomerGeographicView("[CUSTOMER]", "[GEOGRAPHIC_VIEW]"),
     };
     // Make the request
     GeographicView response = geographicViewServiceClient.GetGeographicView(request);
 }
 /// <summary>Snippet for GetGeographicView</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGeographicViewRequestObject()
 {
     // Create client
     GeographicViewServiceClient geographicViewServiceClient = GeographicViewServiceClient.Create();
     // Initialize request argument(s)
     GetGeographicViewRequest request = new GetGeographicViewRequest
     {
         ResourceNameAsGeographicViewName = GeographicViewName.FromCustomerCountryCriterionLocationType("[CUSTOMER_ID]", "[COUNTRY_CRITERION_ID]", "[LOCATION_TYPE]"),
     };
     // Make the request
     GeographicView response = geographicViewServiceClient.GetGeographicView(request);
 }
Пример #3
0
        /// <summary>Snippet for GetGeographicViewAsync</summary>
        public async Task GetGeographicViewRequestObjectAsync()
        {
            // Snippet: GetGeographicViewAsync(GetGeographicViewRequest, CallSettings)
            // Additional: GetGeographicViewAsync(GetGeographicViewRequest, CancellationToken)
            // Create client
            GeographicViewServiceClient geographicViewServiceClient = await GeographicViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetGeographicViewRequest request = new GetGeographicViewRequest
            {
                ResourceNameAsGeographicViewName = GeographicViewName.FromCustomerGeographicView("[CUSTOMER]", "[GEOGRAPHIC_VIEW]"),
            };
            // Make the request
            GeographicView response = await geographicViewServiceClient.GetGeographicViewAsync(request);

            // End snippet
        }
Пример #4
0
        /// <summary>Snippet for GetGeographicViewAsync</summary>
        public async Task GetGeographicViewRequestObjectAsync()
        {
            // Snippet: GetGeographicViewAsync(GetGeographicViewRequest, CallSettings)
            // Additional: GetGeographicViewAsync(GetGeographicViewRequest, CancellationToken)
            // Create client
            GeographicViewServiceClient geographicViewServiceClient = await GeographicViewServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetGeographicViewRequest request = new GetGeographicViewRequest
            {
                ResourceNameAsGeographicViewName = GeographicViewName.FromCustomerCountryCriterionLocationType("[CUSTOMER_ID]", "[COUNTRY_CRITERION_ID]", "[LOCATION_TYPE]"),
            };
            // Make the request
            GeographicView response = await geographicViewServiceClient.GetGeographicViewAsync(request);

            // End snippet
        }
Пример #5
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();
        }
Пример #6
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();
        }
Пример #7
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();
        }
Пример #9
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();
        }