using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; using NUnit.Framework; using Portoa.NHibernate; namespace VideoGameQuotes.Api.Tests.NHibernate { [TestFixture, Ignore] public class SchemaExporter { [Test] public void Export_schema() { new SchemaExport(GetConfig()) .SetDelimiter(";") .SetOutputFile(@"c:\users\tmont\code\VideoGameQuotes\Tests\VideoGameQuotes.Api.Tests\NHibernate\schema.sql") .Execute(false, true, false); } private Configuration GetConfig() { return new Configuration().Configure(GetType().Assembly, GetType().Namespace + ".hibernate.cfg.xml"); } [Test] public void Create_admin() { var config = GetConfig(); var admin = new User { Username = "admin", Group = UserGroup.Admin }; admin.ChangePassword("password"); var session = config.BuildSessionFactory().OpenSession(); using (var tx = session.BeginTransaction()) { new NHibernateRepository(session).Save(admin); tx.Commit(); } } } }