public async stt::Task GetBillingSetupRequestObjectAsync()
        {
            moq::Mock <BillingSetupService.BillingSetupServiceClient> mockGrpcClient = new moq::Mock <BillingSetupService.BillingSetupServiceClient>(moq::MockBehavior.Strict);
            GetBillingSetupRequest request = new GetBillingSetupRequest
            {
                ResourceNameAsBillingSetupName = gagvr::BillingSetupName.FromCustomerBillingSetup("[CUSTOMER]", "[BILLING_SETUP]"),
            };
            gagvr::BillingSetup expectedResponse = new gagvr::BillingSetup
            {
                ResourceNameAsBillingSetupName = gagvr::BillingSetupName.FromCustomerBillingSetup("[CUSTOMER]", "[BILLING_SETUP]"),
                Id            = -6774108720365892680L,
                Status        = gagve::BillingSetupStatusEnum.Types.BillingSetupStatus.Pending,
                StartDateTime = "start_date_timeea924cb1",
                StartTimeType = gagve::TimeTypeEnum.Types.TimeType.Unknown,
                PaymentsAccountAsPaymentsAccountName = gagvr::PaymentsAccountName.FromCustomerPaymentsAccount("[CUSTOMER]", "[PAYMENTS_ACCOUNT]"),
                PaymentsAccountInfo = new gagvr::BillingSetup.Types.PaymentsAccountInfo(),
                EndDateTime         = "end_date_timea95363f3",
                EndTimeType         = gagve::TimeTypeEnum.Types.TimeType.Unspecified,
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public async Task GetBillingSetupAsync2()
        {
            Mock <BillingSetupService.BillingSetupServiceClient> mockGrpcClient = new Mock <BillingSetupService.BillingSetupServiceClient>(MockBehavior.Strict);
            GetBillingSetupRequest request = new GetBillingSetupRequest
            {
                ResourceName = new BillingSetupName("[CUSTOMER]", "[BILLING_SETUP]").ToString(),
            };
            BillingSetup expectedResponse = new BillingSetup
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetBillingSetupAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <BillingSetup>(Task.FromResult(expectedResponse), null, null, null, null));
            BillingSetupServiceClient client = new BillingSetupServiceClientImpl(mockGrpcClient.Object, null);
            BillingSetup response            = await client.GetBillingSetupAsync(request);

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