/// <summary>Snippet for GetGoogleAdsField</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetGoogleAdsFieldRequestObject() { // Create client GoogleAdsFieldServiceClient googleAdsFieldServiceClient = GoogleAdsFieldServiceClient.Create(); // Initialize request argument(s) GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest { ResourceNameAsGoogleAdsFieldName = GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), }; // Make the request GoogleAdsField response = googleAdsFieldServiceClient.GetGoogleAdsField(request); }
public async stt::Task GetGoogleAdsFieldRequestObjectAsync() { moq::Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient> mockGrpcClient = new moq::Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient>(moq::MockBehavior.Strict); GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest { ResourceNameAsGoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), }; gagvr::GoogleAdsField expectedResponse = new gagvr::GoogleAdsField { ResourceNameAsGoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), Category = gagve::GoogleAdsFieldCategoryEnum.Types.GoogleAdsFieldCategory.Segment, DataType = gagve::GoogleAdsFieldDataTypeEnum.Types.GoogleAdsFieldDataType.Message, GoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), Selectable = true, Filterable = true, Sortable = true, SelectableWith = { "selectable_with6b2ad4c4", }, AttributeResources = { "attribute_resources3f8a5e5c", }, Metrics = { "metrics7cd659aa", }, Segments = { "segments982d981f", }, EnumValues = { "enum_values30797dbe", }, TypeUrl = "type_urlfde5623b", IsRepeated = false, }; mockGrpcClient.Setup(x => x.GetGoogleAdsFieldAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::GoogleAdsField>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GoogleAdsFieldServiceClient client = new GoogleAdsFieldServiceClientImpl(mockGrpcClient.Object, null); gagvr::GoogleAdsField responseCallSettings = await client.GetGoogleAdsFieldAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gagvr::GoogleAdsField responseCancellationToken = await client.GetGoogleAdsFieldAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetGoogleAdsFieldAsync</summary> public async Task GetGoogleAdsFieldRequestObjectAsync() { // Snippet: GetGoogleAdsFieldAsync(GetGoogleAdsFieldRequest, CallSettings) // Additional: GetGoogleAdsFieldAsync(GetGoogleAdsFieldRequest, CancellationToken) // Create client GoogleAdsFieldServiceClient googleAdsFieldServiceClient = await GoogleAdsFieldServiceClient.CreateAsync(); // Initialize request argument(s) GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest { ResourceNameAsGoogleAdsFieldName = GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), }; // Make the request GoogleAdsField response = await googleAdsFieldServiceClient.GetGoogleAdsFieldAsync(request); // End snippet }
public void GetGoogleAdsFieldRequestObject() { moq::Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient> mockGrpcClient = new moq::Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient>(moq::MockBehavior.Strict); GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest { ResourceNameAsGoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), }; gagvr::GoogleAdsField expectedResponse = new gagvr::GoogleAdsField { ResourceNameAsGoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), Category = gagve::GoogleAdsFieldCategoryEnum.Types.GoogleAdsFieldCategory.Segment, DataType = gagve::GoogleAdsFieldDataTypeEnum.Types.GoogleAdsFieldDataType.Message, GoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"), Selectable = true, Filterable = true, Sortable = true, SelectableWith = { "selectable_with6b2ad4c4", }, AttributeResources = { "attribute_resources3f8a5e5c", }, Metrics = { "metrics7cd659aa", }, Segments = { "segments982d981f", }, EnumValues = { "enum_values30797dbe", }, TypeUrl = "type_urlfde5623b", IsRepeated = false, }; mockGrpcClient.Setup(x => x.GetGoogleAdsField(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GoogleAdsFieldServiceClient client = new GoogleAdsFieldServiceClientImpl(mockGrpcClient.Object, null); gagvr::GoogleAdsField response = client.GetGoogleAdsField(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetGoogleAdsField2() { Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient> mockGrpcClient = new Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient>(MockBehavior.Strict); GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest { ResourceName = new GoogleAdsFieldName("[GOOGLE_ADS_FIELD]").ToString(), }; GoogleAdsField expectedResponse = new GoogleAdsField { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetGoogleAdsField(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); GoogleAdsFieldServiceClient client = new GoogleAdsFieldServiceClientImpl(mockGrpcClient.Object, null); GoogleAdsField response = client.GetGoogleAdsField(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetGoogleAdsFieldAsync2() { Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient> mockGrpcClient = new Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient>(MockBehavior.Strict); GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest { ResourceName = new GoogleAdsFieldName("[GOOGLE_ADS_FIELD]").ToString(), }; GoogleAdsField expectedResponse = new GoogleAdsField { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetGoogleAdsFieldAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <GoogleAdsField>(Task.FromResult(expectedResponse), null, null, null, null)); GoogleAdsFieldServiceClient client = new GoogleAdsFieldServiceClientImpl(mockGrpcClient.Object, null); GoogleAdsField response = await client.GetGoogleAdsFieldAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }