public void referencing_entities_enough_one_way()
        {
            Order order = new Order(DateTime.Now);
            Db.Order.Add(order);
            Db.SaveChanges();

            ReinitDb();
            var item = new LineItem("cheese", 10);
            item.Order = Db.Order.Find(order.Id);
            Db.LineItems.Add(item);
            Db.SaveChanges();

            ReinitDb();
            item = Db.LineItems.Find(item.Id);
            order = Db.Order.Find(order.Id);
            Assert.IsNotNull(item.Order);
            Assert.AreEqual(order.Items.Count, 1);


            order = new Order(DateTime.Now);
            Db.Order.Add(order);
            Db.SaveChanges();

            ReinitDb();
            item = new LineItem("cheese", 10);
            order.Items = new List<LineItem>() { item };
            Db.SaveChanges();

            ReinitDb();
            item = Db.LineItems.Find(item.Id);
            order = Db.Order.Find(order.Id);
            Assert.IsNotNull(item.Order);
            Assert.AreEqual(order.Items.Count, 1);
        }
        public void concurrency_token_causes_concurrency_exception_when_updated_and_saved_twice()
        {
            var item = new LineItem()
            {
                Name = "SSD",
                Price = 1.1111111111m
            };
            Db.LineItems.Add(item);
            Db.SaveChanges();

            ReinitDb();
            item = Db.LineItems.Find(item.Id);
            item.Price = 1.111111111111m;
            Assert.IsTrue(Db.Entry(item).State == EntityState.Modified);
            Db.SaveChanges();

            item.Price = 1.1161111111m;
            Assert.IsTrue(Db.Entry(item).State == EntityState.Modified);
            Db.SaveChanges();
        }