コード例 #1
0
        public async Task PrepareTests()
        {
            var request = new AccountRequestMessage {
                Name = "*****@*****.**", CommissionPercent = 10
            };

            var responseContent = JsonConvert.SerializeObject(new Fixture().Build <AccountModel>()
                                                              .With(a => a.Name, request.Name)
                                                              .Create());

            using (IHttpClientWrapper stubHttpClient = new StubHttpClient(new StringContent(responseContent, Encoding.UTF8, "application/json")))
                using (IApiResources apiClient = new APIResource(stubHttpClient))
                    using (var client = new MarketPlace(apiClient))
                    {
                        response = await client.CreateUnderAccountAsync(request).ConfigureAwait(false);
                    }

            var address     = new Fixture().Build <AddressModel>().Create();
            var fullAddress = $"{address.Street}, {address.Number} - {address.City} - {address.State}/{address.Country}";

            expectedResponse = new VerifyAccountResponseMessage
            {
                AccountId = response.AccountId,
                Data      = new AccountModel(fullAddress)
                {
                    PriceRange              = "Entre R$ 100,00 e R$ 500,00",
                    PhysicalProducts        = false,
                    BusinessDescription     = "Negócios online",
                    PersonType              = Constants.PersonType.INDIVIDUAL_PERSON,
                    AcceptAutomaticTransfer = true,
                    CPF               = "42753418306",
                    Name              = "Meu Cliente",
                    Phone             = "2199999999",
                    Bank              = Constants.SupportedBanks.CAIXA_ECONOMICA,
                    AccountType       = Constants.BankAccountType.CHECKING_ACCOUNT,
                    BankAgency        = "1520",
                    BankAccountNumber = "00100021066-6"
                },
            };
        }
コード例 #2
0
        public async Task Create_a_under_acoount_with_success()
        {
            // Arrange
            var request = new AccountRequestMessage {
                Name = "*****@*****.**", CommissionPercent = 10
            };
            AccountResponseMessage response;

            var responseContent = JsonConvert.SerializeObject(new Fixture().Build <AccountModel>()
                                                              .With(a => a.Name, request.Name)
                                                              .Create());

            // Act
            using (IHttpClientWrapper stubHttpClient = new StubHttpClient(new StringContent(responseContent, Encoding.UTF8, "application/json")))
                using (IApiResources apiClient = new APIResource(stubHttpClient))
                    using (var client = new MarketPlace(apiClient))
                    {
                        response = await client.CreateUnderAccountAsync(request).ConfigureAwait(false);
                    }

            // Assert
            Assert.That(response.Name, Is.EqualTo(request.Name));
        }