コード例 #1
0
        public async Task List_all_plans()
        {
            // Arrange
            var radomPlan = Guid.NewGuid().ToString();
            var planId    = $"{radomPlan}-Plan";
            int originalCountPlans;
            var newCountPlans = 0;

            // Act
            using (var apiPlan = new Plans())
            {
                var planRequest = new PlanRequestMessage($"{radomPlan}-12x", planId, 1, PlanIntervalType.Monthly, 0)
                {
                    PaymentMethod = Constants.PaymentMethod.BANK_SLIP
                };

                var currentPlans = await apiPlan.GetAllAsync("74c265aedbfaea379bc0148fae9b5526").ConfigureAwait(false);

                originalCountPlans = currentPlans.TotalItems;
                var response = await apiPlan.CreateAsync(planRequest, "74c265aedbfaea379bc0148fae9b5526").ConfigureAwait(false);

                var newPlan = await apiPlan.GetByIdentifierAsync(response.identifier).ConfigureAwait(false);

                newCountPlans = newPlan != null ? originalCountPlans + 1 : newCountPlans;
            };

            // Assert
            Assert.That(newCountPlans, Is.GreaterThan(originalCountPlans));
        }