public async stt::Task CreateBudgetRequestObjectAsync() { moq::Mock <BudgetService.BudgetServiceClient> mockGrpcClient = new moq::Mock <BudgetService.BudgetServiceClient>(moq::MockBehavior.Strict); CreateBudgetRequest request = new CreateBudgetRequest { ParentAsBillingAccountName = gagr::BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"), Budget = new Budget(), }; Budget expectedResponse = new Budget { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), DisplayName = "display_name137f65c2", BudgetFilter = new Filter(), Amount = new BudgetAmount(), ThresholdRules = { new ThresholdRule(), }, AllUpdatesRule = new AllUpdatesRule(), Etag = "etage8ad7218", }; mockGrpcClient.Setup(x => x.CreateBudgetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Budget>(stt::Task.FromResult(expectedResponse), null, null, null, null)); BudgetServiceClient client = new BudgetServiceClientImpl(mockGrpcClient.Object, null); Budget responseCallSettings = await client.CreateBudgetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Budget responseCancellationToken = await client.CreateBudgetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void UpdateBudgetRequestObject() { moq::Mock <BudgetService.BudgetServiceClient> mockGrpcClient = new moq::Mock <BudgetService.BudgetServiceClient>(moq::MockBehavior.Strict); UpdateBudgetRequest request = new UpdateBudgetRequest { Budget = new Budget(), UpdateMask = new wkt::FieldMask(), }; Budget expectedResponse = new Budget { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), DisplayName = "display_name137f65c2", BudgetFilter = new Filter(), Amount = new BudgetAmount(), ThresholdRules = { new ThresholdRule(), }, AllUpdatesRule = new AllUpdatesRule(), Etag = "etage8ad7218", }; mockGrpcClient.Setup(x => x.UpdateBudget(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); BudgetServiceClient client = new BudgetServiceClientImpl(mockGrpcClient.Object, null); Budget response = client.UpdateBudget(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateBudgetResourceNames() { moq::Mock <BudgetService.BudgetServiceClient> mockGrpcClient = new moq::Mock <BudgetService.BudgetServiceClient>(moq::MockBehavior.Strict); CreateBudgetRequest request = new CreateBudgetRequest { ParentAsBillingAccountName = gagr::BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"), Budget = new Budget(), }; Budget expectedResponse = new Budget { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), DisplayName = "display_name137f65c2", BudgetFilter = new Filter(), Amount = new BudgetAmount(), ThresholdRules = { new ThresholdRule(), }, NotificationsRule = new NotificationsRule(), Etag = "etage8ad7218", }; mockGrpcClient.Setup(x => x.CreateBudget(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); BudgetServiceClient client = new BudgetServiceClientImpl(mockGrpcClient.Object, null); Budget response = client.CreateBudget(request.ParentAsBillingAccountName, request.Budget); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetBudget</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetBudgetResourceNames() { // Create client BudgetServiceClient budgetServiceClient = BudgetServiceClient.Create(); // Initialize request argument(s) BudgetName name = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"); // Make the request Budget response = budgetServiceClient.GetBudget(name); }
/// <summary>Snippet for GetBudgetAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetBudgetResourceNamesAsync() { // Create client BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync(); // Initialize request argument(s) BudgetName name = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"); // Make the request Budget response = await budgetServiceClient.GetBudgetAsync(name); }
/// <summary>Snippet for DeleteBudget</summary> public void DeleteBudgetResourceNames() { // Snippet: DeleteBudget(BudgetName, CallSettings) // Create client BudgetServiceClient budgetServiceClient = BudgetServiceClient.Create(); // Initialize request argument(s) BudgetName name = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"); // Make the request budgetServiceClient.DeleteBudget(name); // End snippet }
/// <summary>Snippet for GetBudget</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetBudgetRequestObject() { // Create client BudgetServiceClient budgetServiceClient = BudgetServiceClient.Create(); // Initialize request argument(s) GetBudgetRequest request = new GetBudgetRequest { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), }; // Make the request Budget response = budgetServiceClient.GetBudget(request); }
/// <summary>Snippet for DeleteBudgetAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task DeleteBudgetRequestObjectAsync() { // Create client BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync(); // Initialize request argument(s) DeleteBudgetRequest request = new DeleteBudgetRequest { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), }; // Make the request await budgetServiceClient.DeleteBudgetAsync(request); }
/// <summary>Snippet for DeleteBudgetAsync</summary> public async Task DeleteBudgetResourceNamesAsync() { // Snippet: DeleteBudgetAsync(BudgetName, CallSettings) // Additional: DeleteBudgetAsync(BudgetName, CancellationToken) // Create client BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync(); // Initialize request argument(s) BudgetName name = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"); // Make the request await budgetServiceClient.DeleteBudgetAsync(name); // End snippet }
/// <summary>Snippet for DeleteBudget</summary> public void DeleteBudgetRequestObject() { // Snippet: DeleteBudget(DeleteBudgetRequest, CallSettings) // Create client BudgetServiceClient budgetServiceClient = BudgetServiceClient.Create(); // Initialize request argument(s) DeleteBudgetRequest request = new DeleteBudgetRequest { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), }; // Make the request budgetServiceClient.DeleteBudget(request); // End snippet }
public void DeleteBudgetRequestObject() { moq::Mock <BudgetService.BudgetServiceClient> mockGrpcClient = new moq::Mock <BudgetService.BudgetServiceClient>(moq::MockBehavior.Strict); DeleteBudgetRequest request = new DeleteBudgetRequest { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteBudget(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); BudgetServiceClient client = new BudgetServiceClientImpl(mockGrpcClient.Object, null); client.DeleteBudget(request); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetBudgetAsync</summary> public async Task GetBudgetRequestObjectAsync() { // Snippet: GetBudgetAsync(GetBudgetRequest, CallSettings) // Additional: GetBudgetAsync(GetBudgetRequest, CancellationToken) // Create client BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync(); // Initialize request argument(s) GetBudgetRequest request = new GetBudgetRequest { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), }; // Make the request Budget response = await budgetServiceClient.GetBudgetAsync(request); // End snippet }
public async stt::Task DeleteBudgetRequestObjectAsync() { moq::Mock <BudgetService.BudgetServiceClient> mockGrpcClient = new moq::Mock <BudgetService.BudgetServiceClient>(moq::MockBehavior.Strict); DeleteBudgetRequest request = new DeleteBudgetRequest { BudgetName = BudgetName.FromBillingAccountBudget("[BILLING_ACCOUNT]", "[BUDGET]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteBudgetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); BudgetServiceClient client = new BudgetServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteBudgetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteBudgetAsync(request, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }