public async stt::Task MutateConversionActionsAsync() { moq::Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new moq::Mock <ConversionActionService.ConversionActionServiceClient>(moq::MockBehavior.Strict); MutateConversionActionsRequest request = new MutateConversionActionsRequest { CustomerId = "customer_id3b3724cb", Operations = { new ConversionActionOperation(), }, }; MutateConversionActionsResponse expectedResponse = new MutateConversionActionsResponse { Results = { new MutateConversionActionResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateConversionActionsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateConversionActionsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); MutateConversionActionsResponse responseCallSettings = await client.MutateConversionActionsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MutateConversionActionsResponse responseCancellationToken = await client.MutateConversionActionsAsync(request.CustomerId, request.Operations, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MutateConversionActionsRequestObject() { moq::Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new moq::Mock <ConversionActionService.ConversionActionServiceClient>(moq::MockBehavior.Strict); MutateConversionActionsRequest request = new MutateConversionActionsRequest { CustomerId = "customer_id3b3724cb", Operations = { new ConversionActionOperation(), }, PartialFailure = false, ValidateOnly = true, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateConversionActionsResponse expectedResponse = new MutateConversionActionsResponse { Results = { new MutateConversionActionResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateConversionActions(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); MutateConversionActionsResponse response = client.MutateConversionActions(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateConversionActions() { moq::Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new moq::Mock <ConversionActionService.ConversionActionServiceClient>(moq::MockBehavior.Strict); MutateConversionActionsRequest request = new MutateConversionActionsRequest { CustomerId = "customer_id3b3724cb", Operations = { new ConversionActionOperation(), }, }; MutateConversionActionsResponse expectedResponse = new MutateConversionActionsResponse { Results = { new MutateConversionActionResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateConversionActions(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); MutateConversionActionsResponse response = client.MutateConversionActions(request.CustomerId, request.Operations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetConversionActionRequestObject() { moq::Mock<ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new moq::Mock<ConversionActionService.ConversionActionServiceClient>(moq::MockBehavior.Strict); GetConversionActionRequest request = new GetConversionActionRequest { ResourceNameAsConversionActionName = gagvr::ConversionActionName.FromCustomerConversionAction("[CUSTOMER]", "[CONVERSION_ACTION]"), }; gagvr::ConversionAction expectedResponse = new gagvr::ConversionAction { ResourceNameAsConversionActionName = gagvr::ConversionActionName.FromCustomerConversionAction("[CUSTOMER]", "[CONVERSION_ACTION]"), Id = -6774108720365892680L, ConversionActionName = gagvr::ConversionActionName.FromCustomerConversionAction("[CUSTOMER]", "[CONVERSION_ACTION]"), Status = gagve::ConversionActionStatusEnum.Types.ConversionActionStatus.Hidden, Type = gagve::ConversionActionTypeEnum.Types.ConversionActionType.GooglePlayInAppPurchase, Category = gagve::ConversionActionCategoryEnum.Types.ConversionActionCategory.AddToCart, OwnerCustomer = "owner_customer43abc24a", IncludeInConversionsMetric = false, ClickThroughLookbackWindowDays = -4831593457096707011L, ViewThroughLookbackWindowDays = -8283075401830951626L, ValueSettings = new gagvr::ConversionAction.Types.ValueSettings(), CountingType = gagve::ConversionActionCountingTypeEnum.Types.ConversionActionCountingType.Unspecified, AttributionModelSettings = new gagvr::ConversionAction.Types.AttributionModelSettings(), TagSnippets = { new gagvc::TagSnippet(), }, PhoneCallDurationSeconds = -8070508326407639729L, AppId = "app_idfead82f3", }; mockGrpcClient.Setup(x => x.GetConversionAction(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); gagvr::ConversionAction response = client.GetConversionAction(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetConversionActionRequestObjectAsync() { moq::Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new moq::Mock <ConversionActionService.ConversionActionServiceClient>(moq::MockBehavior.Strict); GetConversionActionRequest request = new GetConversionActionRequest { ResourceNameAsConversionActionName = gagvr::ConversionActionName.FromCustomerConversionAction("[CUSTOMER_ID]", "[CONVERSION_ACTION_ID]"), }; gagvr::ConversionAction expectedResponse = new gagvr::ConversionAction { ResourceNameAsConversionActionName = gagvr::ConversionActionName.FromCustomerConversionAction("[CUSTOMER_ID]", "[CONVERSION_ACTION_ID]"), Status = gagve::ConversionActionStatusEnum.Types.ConversionActionStatus.Hidden, Type = gagve::ConversionActionTypeEnum.Types.ConversionActionType.Salesforce, Category = gagve::ConversionActionCategoryEnum.Types.ConversionActionCategory.AddToCart, ValueSettings = new gagvr::ConversionAction.Types.ValueSettings(), CountingType = gagve::ConversionActionCountingTypeEnum.Types.ConversionActionCountingType.Unspecified, AttributionModelSettings = new gagvr::ConversionAction.Types.AttributionModelSettings(), TagSnippets = { new gagvc::TagSnippet(), }, MobileAppVendor = gagve::MobileAppVendorEnum.Types.MobileAppVendor.GoogleAppStore, FirebaseSettings = new gagvr::ConversionAction.Types.FirebaseSettings(), ThirdPartyAppAnalyticsSettings = new gagvr::ConversionAction.Types.ThirdPartyAppAnalyticsSettings(), Id = -6774108720365892680L, ConversionActionName = gagvr::ConversionActionName.FromCustomerConversionAction("[CUSTOMER_ID]", "[CONVERSION_ACTION_ID]"), OwnerCustomerAsCustomerName = gagvr::CustomerName.FromCustomer("[CUSTOMER_ID]"), IncludeInConversionsMetric = false, ClickThroughLookbackWindowDays = -4831593457096707011L, ViewThroughLookbackWindowDays = -8283075401830951626L, PhoneCallDurationSeconds = -8070508326407639729L, AppId = "app_idfead82f3", Origin = gagve::ConversionOriginEnum.Types.ConversionOrigin.App, PrimaryForGoal = false, }; mockGrpcClient.Setup(x => x.GetConversionActionAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::ConversionAction>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); gagvr::ConversionAction responseCallSettings = await client.GetConversionActionAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::ConversionAction responseCancellationToken = await client.GetConversionActionAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task MutateConversionActionsAsync3() { Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new Mock <ConversionActionService.ConversionActionServiceClient>(MockBehavior.Strict); MutateConversionActionsRequest request = new MutateConversionActionsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateConversionActionsResponse expectedResponse = new MutateConversionActionsResponse(); mockGrpcClient.Setup(x => x.MutateConversionActionsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateConversionActionsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); MutateConversionActionsResponse response = await client.MutateConversionActionsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateConversionActions3() { Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new Mock <ConversionActionService.ConversionActionServiceClient>(MockBehavior.Strict); MutateConversionActionsRequest request = new MutateConversionActionsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateConversionActionsResponse expectedResponse = new MutateConversionActionsResponse(); mockGrpcClient.Setup(x => x.MutateConversionActions(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); MutateConversionActionsResponse response = client.MutateConversionActions(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetConversionAction2() { Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new Mock <ConversionActionService.ConversionActionServiceClient>(MockBehavior.Strict); GetConversionActionRequest request = new GetConversionActionRequest { ResourceName = new ConversionActionName("[CUSTOMER]", "[CONVERSION_ACTION]").ToString(), }; ConversionAction expectedResponse = new ConversionAction { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetConversionAction(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); ConversionAction response = client.GetConversionAction(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetConversionActionAsync() { Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new Mock <ConversionActionService.ConversionActionServiceClient>(MockBehavior.Strict); GetConversionActionRequest expectedRequest = new GetConversionActionRequest { ResourceName = new ConversionActionName("[CUSTOMER]", "[CONVERSION_ACTION]").ToString(), }; ConversionAction expectedResponse = new ConversionAction { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetConversionActionAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ConversionAction>(Task.FromResult(expectedResponse), null, null, null, null)); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); string formattedResourceName = new ConversionActionName("[CUSTOMER]", "[CONVERSION_ACTION]").ToString(); ConversionAction response = await client.GetConversionActionAsync(formattedResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task MutateConversionActionsAsync() { Mock <ConversionActionService.ConversionActionServiceClient> mockGrpcClient = new Mock <ConversionActionService.ConversionActionServiceClient>(MockBehavior.Strict); MutateConversionActionsRequest expectedRequest = new MutateConversionActionsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateConversionActionsResponse expectedResponse = new MutateConversionActionsResponse(); mockGrpcClient.Setup(x => x.MutateConversionActionsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateConversionActionsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); ConversionActionServiceClient client = new ConversionActionServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <ConversionActionOperation> operations = new List <ConversionActionOperation>(); bool partialFailure = true; bool validateOnly = false; MutateConversionActionsResponse response = await client.MutateConversionActionsAsync(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }