This is what I do first a class like InMemoryFixture that the rest inherit frompublic class InMemoryFixture { private static Configuration _config; private static ISessionFactory _sessionFactory; protected ISession Session;
public InMemoryFixture() { if (_config == null) { _config = GetConfig(); _sessionFactory = _config.BuildSessionFactory(); } Session = _sessionFactory.OpenSession(); new SchemaExport(_config).Execute(true, true, false, Session.Connection, Console.Out); } private Configuration GetConfig() { return GetMappings() .Database(SQLiteConfiguration.Standard.InMemory) .BuildConfiguration(); } private FluentConfiguration GetMappings() { return Fluently.Configure().Mappings(m => m.FluentMappings.AddFromAssemblyOf<NewsMap>()); } } [TestFixture] public class Verify_that : InMemoryFixture { [Test] public void Board_is_correctly_mapped() { new PersistenceSpecification<Board>(Session) .CheckProperty(c => c.Id, 1) .CheckProperty(c => c.Title, "The board") .VerifyTheMappings(); } } 2009/9/13 Asbjørn Ulsberg <asbjo...@gmail.com> > > Just define a separate class in your test project and decorate it with > [SetupFixture] along with a public void decorated with [SetUp]. That will > run once for the whole test project. > > > -Asbjørn > > > > On Wed, 12 Aug 2009 13:11:58 +0200, Paul Hinett > <p...@ukcreativedesigns.com> wrote: > > > Hi, > > > > > > Just a quick question about where is the best place to initialize the > > ServiceLocator before all my Data tests are run. At the moment i am > > running > > it in the [TestFixtureSetup] before each test. > > > > > > I was wondering if there is a more global place to initialise it so i > > don't > > have to do this for every test. > > > > > > Regards, > > > > Paul Hinett > > > > > > w: http://www.ukcreativedesigns.com | e: p...@ukcreativedesigns.com | t: > > 07958 552 157 > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibernate@googlegroups.com To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---