public void Test_SaveOrderAndCommitUsingRepository()
        {
            Order order = new Order();
              //order.CustomFields = new System.Collections.Hashtable();
              //order.CustomFields.Add("OrderDate", DateTime.Now);
              HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
              IRepository<Order> orderRepo = new NHRepository<Order>();

              var orders = orderRepo.All();
              int countBefore = orders.Count();

              orderRepo.Save(order);

              int countAfter = orders.Count();

              Assert.AreEqual(countAfter, countBefore + 1);
        }
        public void Test_SaveOrderAndCustomerAndEmployeeUsingRepositoryUsingCascadedSaves()
        {
            Order o = new Order();

              Customer c = new Customer();
              o.Customer = c;
              c.CustomerId = GenerateAndReturnARandomCustomerId();
              c.CompanyName = "Some company";

              Employee e = new Employee();
              o.Employee = e;
              e.FirstName = "Dummy";
              e.LastName = "Employee";

              HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();
              IRepository<Order> orderRepo = new NHRepository<Order>();
              IRepository<Customer> custRepo = new NHRepository<Customer>();
              IRepository<Employee> empRepo = new NHRepository<Employee>();

              int countOrdersBefore = orderRepo.All().Count();
              int countEmployeesBefore = empRepo.All().Count();
              int countCustomerBefore = custRepo.All().Count();

              orderRepo.Save(o);

              int countOrdersAfter = orderRepo.All().Count();
              int countEmployeesAfter = empRepo.All().Count();
              int countCustomerAfter = custRepo.All().Count();

              Debug.Write(o.OrderId);

              Assert.AreEqual(countOrdersBefore+1,countOrdersAfter);
              Assert.AreEqual(countEmployeesBefore+1,countEmployeesAfter);
              Assert.AreEqual(countCustomerBefore+1,countCustomerAfter);
        }
        public void Test_LoadAllOrdersUsingRepository()
        {
            HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();

              var orderRepository = new NHRepository<Order>();
              var orders = orderRepository.All();
              List<Order> orderList = orders.ToList<Order>();
              Customer c = orderList[0].Customer;
              Employee e = orderList[0].Employee;
              Assert.IsNotNull(c);
              Assert.IsNotNull(e);
              Assert.AreEqual("VINET", c.CustomerId);
              Assert.AreEqual(5, e.EmployeeId);
        }