public static void Open <TPersistenceAdapter>(string connectionString) where TPersistenceAdapter : IPersistenceAdapter, new() { SessionContext.SetContext(new WebSessionContext <ISession>()); SessionFactoryContext.SetContext(new StaticContext <ISessionFactory>()); TransactionContext.SetContext(new WebSessionContext <IDbTransaction>()); var factory = new SessionFactoryImpl() .SetAdapter(new TPersistenceAdapter()) .SetConnectionString(connectionString); SessionFactoryContext.Bind(factory); }
public void SessionFactoryContext_Can_Bind_Session_Instance() { SessionFactoryContext.Bind(SessionFactoryMock.Object); ContextMock.Verify(c => c.Bind(SessionFactoryMock.Object)); }