コード例 #1
0
        public void GetGeoTargetConstantRequestObject()
        {
            moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(moq::MockBehavior.Strict);
            GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
            {
                ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
            };
            gagvr::GeoTargetConstant expectedResponse = new gagvr::GeoTargetConstant
            {
                ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
                Status = gagve::GeoTargetConstantStatusEnum.Types.GeoTargetConstantStatus.Enabled,
                ParentGeoTargetAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
                Id = -6774108720365892680L,
                GeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
                CountryCode           = "country_code8debec55",
                TargetType            = "target_type1235462e",
                CanonicalName         = "canonical_name5e3d81e6",
            };

            mockGrpcClient.Setup(x => x.GetGeoTargetConstant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GeoTargetConstantServiceClient client   = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::GeoTargetConstant       response = client.GetGeoTargetConstant(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public async stt::Task GetGeoTargetConstantResourceNamesAsync()
        {
            moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new moq::Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(moq::MockBehavior.Strict);
            GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
            {
                ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
            };
            gagvr::GeoTargetConstant expectedResponse = new gagvr::GeoTargetConstant
            {
                ResourceNameAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
                Status = gagve::GeoTargetConstantStatusEnum.Types.GeoTargetConstantStatus.Enabled,
                ParentGeoTargetAsGeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
                Id = -6774108720365892680L,
                GeoTargetConstantName = gagvr::GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
                CountryCode           = "country_code8debec55",
                TargetType            = "target_type1235462e",
                CanonicalName         = "canonical_name5e3d81e6",
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::GeoTargetConstant responseCancellationToken = await client.GetGeoTargetConstantAsync(request.ResourceNameAsGeoTargetConstantName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetGeoTargetConstant</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGeoTargetConstantRequestObject()
 {
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
     {
         ResourceNameAsGeoTargetConstantName = GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
     };
     // Make the request
     GeoTargetConstant response = geoTargetConstantServiceClient.GetGeoTargetConstant(request);
 }
コード例 #4
0
 /// <summary>Snippet for GetGeoTargetConstant</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGeoTargetConstantRequestObject()
 {
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
     {
         ResourceNameAsGeoTargetConstantName = GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"),
     };
     // Make the request
     GeoTargetConstant response = geoTargetConstantServiceClient.GetGeoTargetConstant(request);
 }
コード例 #5
0
        /// <summary>Snippet for GetGeoTargetConstantAsync</summary>
        public async Task GetGeoTargetConstantRequestObjectAsync()
        {
            // Snippet: GetGeoTargetConstantAsync(GetGeoTargetConstantRequest, CallSettings)
            // Additional: GetGeoTargetConstantAsync(GetGeoTargetConstantRequest, CancellationToken)
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
            {
                ResourceNameAsGeoTargetConstantName = GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
            };
            // Make the request
            GeoTargetConstant response = await geoTargetConstantServiceClient.GetGeoTargetConstantAsync(request);

            // End snippet
        }
        public void GetGeoTargetConstant2()
        {
            Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(MockBehavior.Strict);
            GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
            {
                ResourceName = new GeoTargetConstantName("[GEO_TARGET_CONSTANT]").ToString(),
            };
            GeoTargetConstant expectedResponse = new GeoTargetConstant
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetGeoTargetConstant(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null);
            GeoTargetConstant response            = client.GetGeoTargetConstant(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetGeoTargetConstantAsync2()
        {
            Mock <GeoTargetConstantService.GeoTargetConstantServiceClient> mockGrpcClient = new Mock <GeoTargetConstantService.GeoTargetConstantServiceClient>(MockBehavior.Strict);
            GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
            {
                ResourceName = new GeoTargetConstantName("[GEO_TARGET_CONSTANT]").ToString(),
            };
            GeoTargetConstant expectedResponse = new GeoTargetConstant
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetGeoTargetConstantAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <GeoTargetConstant>(Task.FromResult(expectedResponse), null, null, null, null));
            GeoTargetConstantServiceClient client = new GeoTargetConstantServiceClientImpl(mockGrpcClient.Object, null);
            GeoTargetConstant response            = await client.GetGeoTargetConstantAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #8
0
 // Partial methods called on each request.
 // Allows per-RPC-call modification to the request and CallSettings objects,
 // before the underlying RPC is performed.
 partial void Modify_GetGeoTargetConstantRequest(ref GetGeoTargetConstantRequest request, ref gaxgrpc::CallSettings settings);
コード例 #9
0
 /// <summary>
 /// Returns the requested geo target constant in full detail.
 /// </summary>
 /// <param name="request">
 /// The request object containing all of the parameters for the API call.
 /// </param>
 /// <param name="callSettings">
 /// If not null, applies overrides to this RPC call.
 /// </param>
 /// <returns>
 /// The RPC response.
 /// </returns>
 public virtual gagvr::GeoTargetConstant GetGeoTargetConstant(
     GetGeoTargetConstantRequest request,
     gaxgrpc::CallSettings callSettings = null)
 {
     throw new sys::NotImplementedException();
 }
コード例 #10
0
 /// <summary>
 /// Returns the requested geo target constant in full detail.
 /// </summary>
 /// <param name="request">
 /// The request object containing all of the parameters for the API call.
 /// </param>
 /// <param name="cancellationToken">
 /// A <see cref="st::CancellationToken"/> to use for this RPC.
 /// </param>
 /// <returns>
 /// A Task containing the RPC response.
 /// </returns>
 public virtual stt::Task <gagvr::GeoTargetConstant> GetGeoTargetConstantAsync(
     GetGeoTargetConstantRequest request,
     st::CancellationToken cancellationToken) => GetGeoTargetConstantAsync(
     request,
     gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));