public void MutateAdGroupAdLabels() { moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(moq::MockBehavior.Strict); MutateAdGroupAdLabelsRequest request = new MutateAdGroupAdLabelsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AdGroupAdLabelOperation(), }, }; MutateAdGroupAdLabelsResponse expectedResponse = new MutateAdGroupAdLabelsResponse { Results = { new MutateAdGroupAdLabelResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateAdGroupAdLabels(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); MutateAdGroupAdLabelsResponse response = client.MutateAdGroupAdLabels(request.CustomerId, request.Operations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task MutateAdGroupAdLabelsAsync() { moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(moq::MockBehavior.Strict); MutateAdGroupAdLabelsRequest request = new MutateAdGroupAdLabelsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AdGroupAdLabelOperation(), }, }; MutateAdGroupAdLabelsResponse expectedResponse = new MutateAdGroupAdLabelsResponse { Results = { new MutateAdGroupAdLabelResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateAdGroupAdLabelsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateAdGroupAdLabelsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); MutateAdGroupAdLabelsResponse responseCallSettings = await client.MutateAdGroupAdLabelsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MutateAdGroupAdLabelsResponse responseCancellationToken = await client.MutateAdGroupAdLabelsAsync(request.CustomerId, request.Operations, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task MutateAdGroupAdLabelsAsync3() { Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(MockBehavior.Strict); MutateAdGroupAdLabelsRequest request = new MutateAdGroupAdLabelsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateAdGroupAdLabelsResponse expectedResponse = new MutateAdGroupAdLabelsResponse(); mockGrpcClient.Setup(x => x.MutateAdGroupAdLabelsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateAdGroupAdLabelsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); MutateAdGroupAdLabelsResponse response = await client.MutateAdGroupAdLabelsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateAdGroupAdLabels3() { Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(MockBehavior.Strict); MutateAdGroupAdLabelsRequest request = new MutateAdGroupAdLabelsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateAdGroupAdLabelsResponse expectedResponse = new MutateAdGroupAdLabelsResponse(); mockGrpcClient.Setup(x => x.MutateAdGroupAdLabels(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); MutateAdGroupAdLabelsResponse response = client.MutateAdGroupAdLabels(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetAdGroupAdLabel2() { Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(MockBehavior.Strict); GetAdGroupAdLabelRequest request = new GetAdGroupAdLabelRequest { ResourceName = new AdGroupAdLabelName("[CUSTOMER]", "[AD_GROUP_AD_LABEL]").ToString(), }; AdGroupAdLabel expectedResponse = new AdGroupAdLabel { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetAdGroupAdLabel(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); AdGroupAdLabel response = client.GetAdGroupAdLabel(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetAdGroupAdLabelAsync2() { Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(MockBehavior.Strict); GetAdGroupAdLabelRequest request = new GetAdGroupAdLabelRequest { ResourceName = new AdGroupAdLabelName("[CUSTOMER]", "[AD_GROUP_AD_LABEL]").ToString(), }; AdGroupAdLabel expectedResponse = new AdGroupAdLabel { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetAdGroupAdLabelAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <AdGroupAdLabel>(Task.FromResult(expectedResponse), null, null, null, null)); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); AdGroupAdLabel response = await client.GetAdGroupAdLabelAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetAdGroupAdLabel() { moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(moq::MockBehavior.Strict); GetAdGroupAdLabelRequest request = new GetAdGroupAdLabelRequest { ResourceNameAsAdGroupAdLabelName = gagvr::AdGroupAdLabelName.FromCustomerAdGroupAdLabel("[CUSTOMER]", "[AD_GROUP_AD_LABEL]"), }; gagvr::AdGroupAdLabel expectedResponse = new gagvr::AdGroupAdLabel { ResourceNameAsAdGroupAdLabelName = gagvr::AdGroupAdLabelName.FromCustomerAdGroupAdLabel("[CUSTOMER]", "[AD_GROUP_AD_LABEL]"), AdGroupAdAsAdGroupAdName = gagvr::AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER]", "[AD_GROUP_AD]"), LabelAsLabelName = gagvr::LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"), }; mockGrpcClient.Setup(x => x.GetAdGroupAdLabel(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); gagvr::AdGroupAdLabel response = client.GetAdGroupAdLabel(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAdGroupAdLabelRequestObjectAsync() { moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new moq::Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(moq::MockBehavior.Strict); GetAdGroupAdLabelRequest request = new GetAdGroupAdLabelRequest { ResourceNameAsAdGroupAdLabelName = gagvr::AdGroupAdLabelName.FromCustomerAdGroupAdLabel("[CUSTOMER]", "[AD_GROUP_AD_LABEL]"), }; gagvr::AdGroupAdLabel expectedResponse = new gagvr::AdGroupAdLabel { ResourceNameAsAdGroupAdLabelName = gagvr::AdGroupAdLabelName.FromCustomerAdGroupAdLabel("[CUSTOMER]", "[AD_GROUP_AD_LABEL]"), AdGroupAdAsAdGroupAdName = gagvr::AdGroupAdName.FromCustomerAdGroupAd("[CUSTOMER]", "[AD_GROUP_AD]"), LabelAsLabelName = gagvr::LabelName.FromCustomerLabel("[CUSTOMER]", "[LABEL]"), }; mockGrpcClient.Setup(x => x.GetAdGroupAdLabelAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::AdGroupAdLabel>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); gagvr::AdGroupAdLabel responseCallSettings = await client.GetAdGroupAdLabelAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gagvr::AdGroupAdLabel responseCancellationToken = await client.GetAdGroupAdLabelAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task MutateAdGroupAdLabelsAsync() { Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient> mockGrpcClient = new Mock <AdGroupAdLabelService.AdGroupAdLabelServiceClient>(MockBehavior.Strict); MutateAdGroupAdLabelsRequest expectedRequest = new MutateAdGroupAdLabelsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateAdGroupAdLabelsResponse expectedResponse = new MutateAdGroupAdLabelsResponse(); mockGrpcClient.Setup(x => x.MutateAdGroupAdLabelsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateAdGroupAdLabelsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); AdGroupAdLabelServiceClient client = new AdGroupAdLabelServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <AdGroupAdLabelOperation> operations = new List <AdGroupAdLabelOperation>(); bool partialFailure = true; bool validateOnly = false; MutateAdGroupAdLabelsResponse response = await client.MutateAdGroupAdLabelsAsync(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }