public void SetUp() { _sessionFactoryContext = new SessionFactoryContext(); _sessionFactory = _sessionFactoryContext.Get<ArtistConfiguration>(SetupInMemoryConfiguration()); _session = _sessionFactory.OpenSession(); InitializeInMemoryDatabase(); _unitOfWork = new UnitOfWorkImpl(_session); }
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 static void Close() { var factory = SessionFactoryContext.Unbind(); // TODO: Close factory if applicable? }
public void SetUp() { _sessionFactoryContext = new SessionFactoryContext(); }
public void SessionFactoryContext_Can_Unbind_Session_Instance() { SessionFactoryContext.Unbind(); ContextMock.Verify(c => c.Unbind()); }
public void SessionFactoryContext_Can_Bind_Session_Instance() { SessionFactoryContext.Bind(SessionFactoryMock.Object); ContextMock.Verify(c => c.Bind(SessionFactoryMock.Object)); }
public void Initialize() { SessionFactoryMock = new Mock <ISessionFactory>(); ContextMock = new Mock <IContext <ISessionFactory> >(); SessionFactoryContext.SetContext(ContextMock.Object); }