Exemple #1
0
        public void AttemptRestore()
        {
            PostulateDb db = new PostulateDb();
            TableB      b  = new TableB()
            {
                OrganizationId = 1, Description = "whatever1"
            };

            db.Save(b);
            db.DeleteOne(b);

            var restoredId = db.RestoreOne <TableB>(b.Id);

            Assert.IsTrue(restoredId != 0);

            db.DeleteOne <TableB>(restoredId);
        }
Exemple #2
0
        public void TrackDeletion()
        {
            PostulateDb db = new PostulateDb();
            TableB      b  = new TableB()
            {
                OrganizationId = 1, Description = "whatever"
            };

            db.Save(b);
            db.DeleteOne(b);
        }
        public async Task CreateOrgAsync()
        {
            var org = new Organization()
            {
                Name = "Async Org", BillingRate = 1
            };
            PostulateDb db = new PostulateDb();
            await db.SaveAsync(org);

            Assert.IsTrue(org.Id != 0);
            db.DeleteOne(org);
        }
        public void CreateDeleteOrgFromRecordNoConnection()
        {
            Organization org = new Organization();

            org.Name        = DefaultOrgName();
            org.BillingRate = 10;

            PostulateDb db = new PostulateDb();

            db.Save(org);
            db.DeleteOne(org);
        }
        public void CreateDeleteOrg()
        {
            Organization org = new Organization();

            org.Name        = DefaultOrgName();
            org.BillingRate = 10;

            PostulateDb db = new PostulateDb();

            db.TraceCallback = (cn, qt) => { QueryUtil.SaveTrace(cn, qt, db); };

            using (IDbConnection cn = db.GetConnection())
            {
                cn.Open();
                db.Save(cn, org);
                db.DeleteOne(cn, org);
            }
        }
        public void Update()
        {
            Organization org = new Organization();

            org.Name        = DefaultOrgName();
            org.BillingRate = 10;

            var db = new PostulateDb();

            db.Save(org);
            int orgId = org.Id;

            org.BillingRate = 11;
            db.Update(org, r => r.BillingRate);

            org = db.Find <Organization>(orgId);
            db.DeleteOne <Organization>(orgId);

            Assert.IsTrue(org.BillingRate == 11);
        }