public void RegisterAdded_Commit_Added ()
		{
			var target = new MemoryUnitOfWork ();
			var user1 = new User ("1");
			var repository = MockRepository.GenerateStrictMock<IUnitOfWorkRepository> ();
			repository.Expect (r => r.PersistNewItem(user1));

			target.RegisterAdded (user1, repository);
		
			target.Commit ();

			repository.VerifyAllExpectations ();
		}
		public void Commit_EntitiesToAddChangeAndDelete_RightCommit ()
		{
			var target = new MemoryUnitOfWork ();

			var userToDelete = new User ("1");
			var userToAdd = new User ("2");
			var userToUpdate = new User ("3");

			var repository = MockRepository.GenerateStrictMock<IUnitOfWorkRepository> ();
			repository.Expect (r => r.PersistDeletedItem(userToDelete));
			repository.Expect (r => r.PersistNewItem(userToAdd));
			repository.Expect (r => r.PersistUpdatedItem(userToUpdate));

			target.RegisterRemoved (userToDelete, repository);
			target.RegisterAdded (userToAdd, repository);
			target.RegisterChanged (userToUpdate, repository);

			target.Commit ();

			repository.VerifyAllExpectations ();
		}
        public void Rollback_EntitiesToAddChangeAndDelete_Undo()
        {
            var target = new MemoryUnitOfWork();

            var userToDelete = new User("1");
            var userToAdd = new User("2");
            var userToUpdate = new User("3");

            var repository = MockRepository.GenerateStrictMock<IUnitOfWorkRepository>();

            target.RegisterRemoved(userToDelete, repository);
            target.RegisterAdded(userToAdd, repository);
            target.RegisterChanged(userToUpdate, repository);

            target.Rollback();
            target.Commit();            

            repository.VerifyAllExpectations();
        }