Ejemplo n.º 1
0
        public void test_create_mult_accounts()
        {
            var rand_email1 = Fixtures.RandomString(10) + "@example.com";
            var rand_email2 = Fixtures.RandomString(10) + "@example.com";

            var accounts = pl.create(
                new[] {
                new pl.Customer(new{ email = rand_email1, name = "Matt Perez" }),
                new pl.Customer(new{ email = rand_email2, name = "Andrea Kearney" })
            }
                );

            var get_account_1 = pl.Account.filter_by(new { email = rand_email1 }).all()[0];
            var get_account_2 = pl.Account.filter_by(new { email = rand_email2 }).all()[0];

            Assert.NotNull(get_account_1);
            Assert.NotNull(get_account_2);
        }
Ejemplo n.º 2
0
        public void test_payment_filters_1()
        {
            String rand_description = Fixtures.RandomString(10);

            var card_payment = pl.Payment.create(new
            {
                amount         = 100.0,
                description    = rand_description,
                payment_method = new pl.Card(new { card_number = "4242 4242 4242 4242", expiry = "12/25" })
            });

            List <dynamic> payments = pl.Payment.filter_by(
                pl.attr.amount.gt(99),
                pl.attr.amount.lt(200),
                pl.attr.description.contains(rand_description),
                pl.attr.created_at.gt(new DateTime(2019, 2, 1))
                ).all();

            Assert.True(payments.Count == 1);
            Assert.True(payments.ElementAt(0).id == card_payment.id);
        }