Ejemplo n.º 1
0
        public void CreateSave(PersistenceManager pm)
        {
            CreateProductAndOrder(pm);
            var logAdapter = new TestLogAdapter();

            pm.VerboseMode = true;
            pm.LogAdapter  = logAdapter;
            CreateOrderDetail();
            pm.Save();
            pm.UnloadCache();
            IList orders = pm.GetClassExtent(typeof(Order));

            Assert.AreEqual(1, orders.Count);
            Order o = (Order)orders[0];

            Assert.AreEqual(1, o.OrderDetails.Count());
            var         text = logAdapter.Text;
            OrderDetail od   = (OrderDetail)o.OrderDetails.First();

            Assert.NotNull(od.Product, "Product shouldn't be null");
        }
Ejemplo n.º 2
0
        public void SimpleObjectSave()
        {
            var pm             = PmFactory.NewPersistenceManager();
            var testLogAdapter = new TestLogAdapter();

            pm.LogAdapter  = testLogAdapter;
            pm.VerboseMode = true;
            pm.MakePersistent(svn);
            pm.Save();
            pm.UnloadCache();
            IList l = pm.GetClassExtent(typeof(Sozialversicherungsnummer));

            Assert.That(l.Count == 1, "Sozialversicherungsnummer sollte gespeichert sein");
            pm.Delete(l);
            pm.Save();
            var text = testLogAdapter.Text;

            pm.UnloadCache();
            l = pm.GetClassExtent(typeof(Sozialversicherungsnummer));
            Assert.That(l.Count == 0, "Sozialversicherungsnummer sollte gelöscht sein");
        }