public static void Setup(TestContext context) { NHibernateHelper.CreateSchema(); DependencyInjector.Kernel.StartNHibernate(); _helperRepository = DependencyInjector.Kernel.Get <IHelperRepository>(); using (var session = _helperRepository.OpenSession()) { var repo = session.GetRepository <Foo>(); try { session.StartTransaction(); var foo1 = new Foo { Bar = 10, DataInclusao = DateTime.Now, UsuarioInclusao = "test" }; var foo2 = new Foo { Bar = 20, DataInclusao = DateTime.Now, UsuarioInclusao = "test" }; var foo3 = new Foo { Bar = 30, DataInclusao = DateTime.Now, UsuarioInclusao = "test" }; repo.Insert(foo1); repo.Insert(foo2); repo.Insert(foo3); session.CommitTransaction(); } catch (Exception ex) { session.RollBackTransaction(); Console.WriteLine(ex.Message); } } }