protected void CleanupDb() { var unitOfWork = Resolve <IUnitOfWork>(); var sessionProvider = Resolve <IContextSessionProvider>(); unitOfWork.Worker(() => { var repository = new TestRepository(sessionProvider); repository.ClearAllData(); unitOfWork.SaveChanges(); }); }