Esempio n. 1
0
        public void checkDelete()
        {
            ITransaction trx = Config.con.BeginTransaction();

            trx.Save(new DM_Order(200, 1, "Another Laser", DateTime.Now, DateTime.Now));

            trx.Commit();

            ITransaction trxA = Config.con.BeginTransaction();
            ITransaction trxB = Config.con.BeginTransaction();

            DM_Order oA = (DM_Order)trxA.Load(typeof(DM_Order), 200);
            DM_Order oB = (DM_Order)trxB.Load(typeof(DM_Order), 200);

            trxA.Delete(oA);

            trxA.Commit();

            Exception ex = null;

            try
            {
                trxB.Delete(oB);
            }
            catch (Exception e)
            {
                ex = e;
            }

            Assert.IsNotNull(ex);
            Assert.AreEqual(typeof(DBConcurrencyException).ToString(), ex.GetType().ToString());
        }
Esempio n. 2
0
        public void loadBySinglePK()
        {
            ITransaction trx = Config.con.BeginTransaction();

            DM_Order order = (DM_Order)trx.Load(
                typeof(DM_Order),
                100);

            trx.Commit();

            Assert.AreEqual(order.order_id, 100);
            Assert.AreEqual(order.customer_id, 1);
            Assert.AreEqual(order.order_description, "Giant Laser");
            Assert.AreEqual(order.order_date, new DateTime(1996, 1, 1));
            Assert.AreEqual(order.date_last_modified, new DateTime(2100, 6, 30));
        }
Esempio n. 3
0
        public void isSavedInsert()
        {
            ITransaction trx = Config.con.BeginTransaction();

            DM_Order order = (DM_Order)trx.Load(
                typeof(DM_Order),
                200);

            Assert.AreEqual(order.customer_id, 2);
            Assert.AreEqual(order.order_description, "Monstrous Laser");
            Assert.AreEqual(order.order_id, 200);

            trx.Delete(order);

            trx.Commit();
        }
Esempio n. 4
0
        public void isSavedUpdate()
        {
            ITransaction trx = Config.con.BeginTransaction();

            DM_Order order = (DM_Order)trx.Load(
                typeof(DM_Order),
                100);

            Assert.AreEqual(order.order_description, "ChangedBySaveTests");

            order.order_description = "Giant Laser";

            trx.Save(order);

            trx.Commit();
        }
Esempio n. 5
0
        public void saveEntityUpdForcedInsert()
        {
            ITransaction trx = Config.con.BeginTransaction();

            DM_Order order = (DM_Order)trx.Load(
                typeof(DM_Order),
                100);

            Assert.AreEqual(order.order_description, "Giant Laser");

            order.order_description = "ChangedBySaveTests";

            trx.Save(order, SaveParams.insert);

            trx.Commit();

            isSavedUpdate();
        }