public void Can_update_existing_customer()
		{
			var customer = _customers[0];
			customer.Firstname= "John";
			ICustomerRepository repository = new CustomerRepository();
			repository.Update(customer);
			
			// use session to try to load the customer
			using (ISession session = _sessionFactory.OpenSession())
			{
				var fromDb = session.Get<Customer>(customer.CustomerID);
				Assert.AreEqual(customer.Firstname, fromDb.Firstname);
			}
		}
		public void Can_add_new_customer()
		{
			var customer = new Customer { Firstname= "Apple", Lastname = "Dethero", DateCreated = DateTime.Now};
			ICustomerRepository repository = new CustomerRepository();
			repository.Add(customer);

			// use session to try to load the customer
			using (ISession session = _sessionFactory.OpenSession())
			{
				var fromDb = session.Get<Customer>(customer.CustomerID);
				// Test that the customer was successfully inserted
				Assert.IsNotNull(fromDb);
				Assert.AreNotSame(customer, fromDb);
				Assert.AreEqual(customer.Firstname, fromDb.Firstname);
			}
		}
		public void Can_remove_existing_customer()
		{
			var customer = _customers[0];
			ICustomerRepository repository = new CustomerRepository();
			repository.Remove(customer);
			using (ISession session = _sessionFactory.OpenSession())
			{
				var fromDB = session.Get<Customer>(customer.CustomerID);
				Assert.IsNull(fromDB);
			}
		}
		public void Can_get_Customers_By_DateCreated()
		{
			ICustomerRepository repository = new CustomerRepository();
			var fromDB = repository.GetByDateCreated(DateTime.Now.AddMinutes(-5), DateTime.Now.AddMinutes(5));

			Assert.IsNotNull(fromDB);
			// needs refactoring, hardcoded 3 from _Customers with dateCreated = now.
			Assert.AreEqual(fromDB.Count, 3);
		}
		public void Fullname_Formula_works()
		{
			ICustomerRepository repository = new CustomerRepository();
			var fromDb = repository.GetByID(_customers[1].CustomerID);
			Assert.IsNotNull(fromDb);
			Assert.AreNotSame(_customers[1], fromDb);
			StringAssert.Contains(fromDb.Firstname, fromDb.Fullname);
			StringAssert.Contains(fromDb.Lastname, fromDb.Fullname);
		}
		public void Can_get_existing_customer_by_name()
		{
			ICustomerRepository repository = new CustomerRepository();
			var fromDb = repository.GetByFirstname(_customers[1].Firstname);

			Assert.IsNotNull(fromDb);
			Assert.AreNotSame(_customers[1], fromDb);
			Assert.AreEqual(_customers[1].CustomerID, fromDb.CustomerID);
		}
		public void Can_Count()
		{
			ICustomerRepository repository = new CustomerRepository();
			Assert.AreEqual(repository.Count(), _customers.Length);
		}
		public void Can_Delete_All_Customers()
		{
			ICustomerRepository repository = new CustomerRepository();
			repository.RemoveAll();
			Assert.AreEqual(repository.Count(), 0);
		}