Ejemplo n.º 1
0
        /// <summary>
        /// Atualizar informações de uma carteira de cliente
        /// </summary>
        /// <param name="bankBilletAccountData">Dados da carteira</param>
        /// <param name="id">Identifiador da carteira</param>
        /// <returns>HttpResponseMessage with HttpStatusCode 204 (NO Content)</returns>
        public async Task <HttpResponseMessage> PutAsync(int id, BankBilletAccount bankBilletAccountData)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), $"{BANK_BILLET_ACCOUNTS_API}/{id}")
                          .WithMethod(HttpMethod.Put)
                          .AndOptionalContent(bankBilletAccountData)
                          .Build();

            return(await _client.SendAsync(request));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Cria uma carteira de cliente
        /// </summary>
        /// <param name="bankBilletAccountData">dados da conta</param>
        /// <returns>Conta criada com sucesso</returns>
        /// <see cref="http://api.boletosimples.com.br/reference/v1/bank_billet_accounts/#criar-carteira"/>
        public async Task <ApiResponse <BankBilletAccount> > PostAsync(BankBilletAccount bankBilletAccountData)
        {
            var request = _requestBuilder.To(_client.Connection.GetBaseUri(), BANK_BILLET_ACCOUNTS_API)
                          .WithMethod(HttpMethod.Post)
                          .AndOptionalContent(bankBilletAccountData)
                          .Build();

            return(await _client.SendAsync <BankBilletAccount>(request));
        }
Ejemplo n.º 3
0
        public async Task Given_input_json_of_model_Bank_Billets_Account_should_be_serialize_and_desesialize_right()
        {
            // Arrange
            BankBilletAccount firstBankBilletAccount  = null;
            BankBilletAccount secondBankBilletAccount = null;

            // Act && Assert
            Assert.DoesNotThrowAsync(async() =>
            {
                firstBankBilletAccount    = await Task.FromResult(JsonConvert.DeserializeObject <BankBilletAccount>(JsonConstants.BankBilletAccount)).ConfigureAwait(false);
                var bankBilletAccountJson = await Task.FromResult(JsonConvert.SerializeObject(firstBankBilletAccount)).ConfigureAwait(false);
                secondBankBilletAccount   = await Task.FromResult(JsonConvert.DeserializeObject <BankBilletAccount>(bankBilletAccountJson)).ConfigureAwait(false);
            });

            // Other Asserts
            firstBankBilletAccount.Should().BeEquivalentTo(secondBankBilletAccount);
        }
Ejemplo n.º 4
0
 public void PrepareTest()
 {
     Content = JsonConvert.DeserializeObject <BankBilletAccount>(JsonConstants.BankBilletAccount);
 }