public void MutateCampaignConversionGoals() { moq::Mock <CampaignConversionGoalService.CampaignConversionGoalServiceClient> mockGrpcClient = new moq::Mock <CampaignConversionGoalService.CampaignConversionGoalServiceClient>(moq::MockBehavior.Strict); MutateCampaignConversionGoalsRequest request = new MutateCampaignConversionGoalsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CampaignConversionGoalOperation(), }, }; MutateCampaignConversionGoalsResponse expectedResponse = new MutateCampaignConversionGoalsResponse { Results = { new MutateCampaignConversionGoalResult(), }, }; mockGrpcClient.Setup(x => x.MutateCampaignConversionGoals(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CampaignConversionGoalServiceClient client = new CampaignConversionGoalServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignConversionGoalsResponse response = client.MutateCampaignConversionGoals(request.CustomerId, request.Operations); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task MutateCampaignConversionGoalsRequestObjectAsync() { moq::Mock <CampaignConversionGoalService.CampaignConversionGoalServiceClient> mockGrpcClient = new moq::Mock <CampaignConversionGoalService.CampaignConversionGoalServiceClient>(moq::MockBehavior.Strict); MutateCampaignConversionGoalsRequest request = new MutateCampaignConversionGoalsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CampaignConversionGoalOperation(), }, ValidateOnly = true, }; MutateCampaignConversionGoalsResponse expectedResponse = new MutateCampaignConversionGoalsResponse { Results = { new MutateCampaignConversionGoalResult(), }, }; mockGrpcClient.Setup(x => x.MutateCampaignConversionGoalsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateCampaignConversionGoalsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CampaignConversionGoalServiceClient client = new CampaignConversionGoalServiceClientImpl(mockGrpcClient.Object, null); MutateCampaignConversionGoalsResponse responseCallSettings = await client.MutateCampaignConversionGoalsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); MutateCampaignConversionGoalsResponse responseCancellationToken = await client.MutateCampaignConversionGoalsAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }