Exemple #1
0
        public async stt::Task GetAccountBudgetRequestObjectAsync()
        {
            moq::Mock <AccountBudgetService.AccountBudgetServiceClient> mockGrpcClient = new moq::Mock <AccountBudgetService.AccountBudgetServiceClient>(moq::MockBehavior.Strict);
            GetAccountBudgetRequest request = new GetAccountBudgetRequest
            {
                ResourceNameAsAccountBudgetName = gagvr::AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER]", "[ACCOUNT_BUDGET]"),
            };
            gagvr::AccountBudget expectedResponse = new gagvr::AccountBudget
            {
                ResourceNameAsAccountBudgetName = gagvr::AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER]", "[ACCOUNT_BUDGET]"),
                Status = gagve::AccountBudgetStatusEnum.Types.AccountBudgetStatus.Cancelled,
                ProposedEndTimeType       = gagve::TimeTypeEnum.Types.TimeType.Unknown,
                ApprovedEndTimeType       = gagve::TimeTypeEnum.Types.TimeType.Forever,
                ProposedSpendingLimitType = gagve::SpendingLimitTypeEnum.Types.SpendingLimitType.Unknown,
                ApprovedSpendingLimitType = gagve::SpendingLimitTypeEnum.Types.SpendingLimitType.Unknown,
                AdjustedSpendingLimitType = gagve::SpendingLimitTypeEnum.Types.SpendingLimitType.Unspecified,
                PendingProposal           = new gagvr::AccountBudget.Types.PendingAccountBudgetProposal(),
                Id = -6774108720365892680L,
                BillingSetupAsBillingSetupName = gagvr::BillingSetupName.FromCustomerBillingSetup("[CUSTOMER]", "[BILLING_SETUP]"),
                AccountBudgetName           = gagvr::AccountBudgetName.FromCustomerAccountBudget("[CUSTOMER]", "[ACCOUNT_BUDGET]"),
                ProposedStartDateTime       = "proposed_start_date_time4e2f84a3",
                ApprovedStartDateTime       = "approved_start_date_time20090a2c",
                ProposedEndDateTime         = "proposed_end_date_time39aa28a5",
                ApprovedEndDateTime         = "approved_end_date_time99d3ab5d",
                ProposedSpendingLimitMicros = 6806956772888455592L,
                ApprovedSpendingLimitMicros = 1674109600829643495L,
                AdjustedSpendingLimitMicros = 5260592673487875057L,
                TotalAdjustmentsMicros      = -1818058180873398375L,
                AmountServedMicros          = -8683779131450697164L,
                PurchaseOrderNumber         = "purchase_order_number7be7181f",
                Notes = "notes00b55843",
            };

            mockGrpcClient.Setup(x => x.GetAccountBudgetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::AccountBudget>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AccountBudgetServiceClient client = new AccountBudgetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::AccountBudget       responseCallSettings = await client.GetAccountBudgetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::AccountBudget responseCancellationToken = await client.GetAccountBudgetAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public void GetAccountBudget2()
        {
            Mock <AccountBudgetService.AccountBudgetServiceClient> mockGrpcClient = new Mock <AccountBudgetService.AccountBudgetServiceClient>(MockBehavior.Strict);
            GetAccountBudgetRequest request = new GetAccountBudgetRequest
            {
                ResourceName = new AccountBudgetName("[CUSTOMER]", "[ACCOUNT_BUDGET]").ToString(),
            };
            AccountBudget expectedResponse = new AccountBudget
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAccountBudget(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AccountBudgetServiceClient client = new AccountBudgetServiceClientImpl(mockGrpcClient.Object, null);
            AccountBudget response            = client.GetAccountBudget(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
        public async Task GetAccountBudgetAsync()
        {
            Mock <AccountBudgetService.AccountBudgetServiceClient> mockGrpcClient = new Mock <AccountBudgetService.AccountBudgetServiceClient>(MockBehavior.Strict);
            GetAccountBudgetRequest expectedRequest = new GetAccountBudgetRequest
            {
                ResourceName = new AccountBudgetName("[CUSTOMER]", "[ACCOUNT_BUDGET]").ToString(),
            };
            AccountBudget expectedResponse = new AccountBudget
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAccountBudgetAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AccountBudget>(Task.FromResult(expectedResponse), null, null, null, null));
            AccountBudgetServiceClient client   = new AccountBudgetServiceClientImpl(mockGrpcClient.Object, null);
            string        formattedResourceName = new AccountBudgetName("[CUSTOMER]", "[ACCOUNT_BUDGET]").ToString();
            AccountBudget response = await client.GetAccountBudgetAsync(formattedResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }