public void TestInsertOrderWithGeneratedIDResult()
 {
     this.TestInsertCustomerNoResult(); // create customer "XX1"
     var order = new Order
     {
         CustomerID = "XX1",
         OrderDate = DateTime.Today,
     };
     var result = db.Orders.Insert(order, o => o.OrderID);
     Assert.AreNotEqual(1, result);
 }
 public void Extension_Table_InsertOrderWithNoResult()
 {
     Extension_Table_InsertCustomerNoResult(); // create customer "XX1"
     var order = new Order
     {
         CustomerID = "XX1",
         OrderDate = DateTime.Today,
     };
     var result = db.Orders.Insert(order);
     Assert.AreEqual(1, result);
 }
        public void TestInsertCustomersIncludeOrders()
        {
            var policy = new EntityPolicy();
            policy.IncludeWith<Customer>(c => c.Orders);
            policy.IncludeWith<Order>(o => o.Details);
            Northwind nw = new Northwind(this.provider.New(policy));

            var cust = new Customer
            {
                CustomerID = "XX1",
                CompanyName = "Company1",
                ContactName = "Contact1",
                City = "Seattle",
                Country = "USA"
            };
            var order = new Order
            {
                CustomerID = "XX1",
                OrderDate = DateTime.Today,
            };
            cust.Orders = new List<Order> { order };

            var custs = nw.Customers.Insert(cust);
            var result = nw.Orders.Insert(order);
            cust = nw.Customers.GetById(cust.CustomerID);
            Assert.AreEqual(1, custs);
            //TODO: Complete Assert
            //Assert.IsNotNull(custs[0].Orders);
            //Assert.AreEqual(6, custs[0].Orders.Count);
            //Assert.IsTrue(custs[0].Orders.Any(o => o.OrderID == 10643));
            //Assert.IsNotNull(custs[0].Orders.Single(o => o.OrderID == 10643).Details);
            //Assert.AreEqual(3, custs[0].Orders.Single(o => o.OrderID == 10643).Details.Count);
        }