Beispiel #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));
        }
Beispiel #2
0
        public async Task Create_a_valid_plan_with_custom_api_token()
        {
            // Arrange
            var       radomPlan = Guid.NewGuid().ToString();
            var       planId    = $"{radomPlan}-Plan";
            PlanModel plan;

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

                plan = await apiPlan.CreateAsync(planRequest, "74c265aedbfaea379bc0148fae9b5526").ConfigureAwait(false);
            };

            // Assert
            Assert.That(plan, Is.Not.Null);
            Assert.That(plan.identifier, Is.EqualTo(planId));
        }
Beispiel #3
0
        /// <summary>
        /// Cria um Plano possibilitando enviar um ApiToken customizado
        /// </summary>
        /// <param name="plan">todo: describe plan parameter on CreateAsync</param>
        /// <param name="customApiToken">todo: describe customApiToken parameter on CreateAsync</param>
        public async Task <PlanModel> CreateAsync(PlanRequestMessage plan, string customApiToken)
        {
            var retorno = await PostAsync <PlanModel>(plan, null, customApiToken).ConfigureAwait(false);

            return(retorno);
        }