/// <summary>Snippet for GraduateCampaignExperiment</summary> public void GraduateCampaignExperimentRequestObject() { // Snippet: GraduateCampaignExperiment(GraduateCampaignExperimentRequest, CallSettings) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = CampaignExperimentServiceClient.Create(); // Initialize request argument(s) GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest { CampaignExperiment = "", CampaignBudget = "", ValidateOnly = false, }; // Make the request GraduateCampaignExperimentResponse response = campaignExperimentServiceClient.GraduateCampaignExperiment(request); // End snippet }
/// <summary>Snippet for GraduateCampaignExperimentAsync</summary> public async Task GraduateCampaignExperimentRequestObjectAsync() { // Snippet: GraduateCampaignExperimentAsync(GraduateCampaignExperimentRequest, CallSettings) // Additional: GraduateCampaignExperimentAsync(GraduateCampaignExperimentRequest, CancellationToken) // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest { CampaignExperiment = "", CampaignBudget = "", }; // Make the request GraduateCampaignExperimentResponse response = await campaignExperimentServiceClient.GraduateCampaignExperimentAsync(request); // End snippet }
public void GraduateCampaignExperiment() { moq::Mock <CampaignExperimentService.CampaignExperimentServiceClient> mockGrpcClient = new moq::Mock <CampaignExperimentService.CampaignExperimentServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest { CampaignExperiment = "campaign_experimente81fbe81", CampaignBudget = "campaign_budgetc3f474d4", }; GraduateCampaignExperimentResponse expectedResponse = new GraduateCampaignExperimentResponse { GraduatedCampaign = "graduated_campaign1b91421c", }; mockGrpcClient.Setup(x => x.GraduateCampaignExperiment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CampaignExperimentServiceClient client = new CampaignExperimentServiceClientImpl(mockGrpcClient.Object, null); GraduateCampaignExperimentResponse response = client.GraduateCampaignExperiment(request.CampaignExperiment, request.CampaignBudget); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GraduateCampaignExperimentResourceNames() { moq::Mock <CampaignExperimentService.CampaignExperimentServiceClient> mockGrpcClient = new moq::Mock <CampaignExperimentService.CampaignExperimentServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest { CampaignExperimentAsCampaignExperimentName = gagvr::CampaignExperimentName.FromCustomerCampaignExperiment("[CUSTOMER_ID]", "[CAMPAIGN_EXPERIMENT_ID]"), CampaignBudget = "campaign_budgetc3f474d4", }; GraduateCampaignExperimentResponse expectedResponse = new GraduateCampaignExperimentResponse { GraduatedCampaign = "graduated_campaign1b91421c", }; mockGrpcClient.Setup(x => x.GraduateCampaignExperiment(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CampaignExperimentServiceClient client = new CampaignExperimentServiceClientImpl(mockGrpcClient.Object, null); GraduateCampaignExperimentResponse response = client.GraduateCampaignExperiment(request.CampaignExperimentAsCampaignExperimentName, request.CampaignBudget); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GraduateCampaignExperimentAsync2() { Mock <CampaignExperimentService.CampaignExperimentServiceClient> mockGrpcClient = new Mock <CampaignExperimentService.CampaignExperimentServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); GraduateCampaignExperimentRequest request = new GraduateCampaignExperimentRequest { CampaignExperiment = new CampaignExperimentName("[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]").ToString(), CampaignBudget = "campaignBudget1992382804", }; GraduateCampaignExperimentResponse expectedResponse = new GraduateCampaignExperimentResponse { GraduatedCampaign = "graduatedCampaign-758391274", }; mockGrpcClient.Setup(x => x.GraduateCampaignExperimentAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <GraduateCampaignExperimentResponse>(Task.FromResult(expectedResponse), null, null, null, null)); CampaignExperimentServiceClient client = new CampaignExperimentServiceClientImpl(mockGrpcClient.Object, null); GraduateCampaignExperimentResponse response = await client.GraduateCampaignExperimentAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }