public void MissingSessionFactoryCausesArgumentExceptionDuringLazyResolving() { SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(null, null); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); ISessionFactory sessionFactory = sss.SessionFactory; }
public void MissingEntityInterceptorIsOkDuringLazyResolving() { ISessionFactory expectedSessionFactory = A.Fake <ISessionFactory>(); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, null); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); Assert.AreSame(expectedSessionFactory, sss.SessionFactory); Assert.AreSame(null, sss.EntityInterceptor); }
public void CallingDefaultConstructorCausesLazyResolvingReferences() { ISessionFactory expectedSessionFactory = A.Fake <ISessionFactory>(); IInterceptor expectedEntityInterceptor = A.Fake <IInterceptor>(); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, expectedEntityInterceptor); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); Assert.AreSame(expectedSessionFactory, sss.SessionFactory); Assert.AreSame(expectedEntityInterceptor, sss.EntityInterceptor); }
public void MissingEntityInterceptorIsOkDuringLazyResolving() { MockRepository mocks = new MockRepository(); ISessionFactory expectedSessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, null); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); Assert.AreSame(expectedSessionFactory, sss.SessionFactory); Assert.AreSame(null, sss.EntityInterceptor); }
public void CallingDefaultConstructorCausesLazyResolvingReferences() { MockRepository mocks = new MockRepository(); ISessionFactory expectedSessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); IInterceptor expectedEntityInterceptor = (IInterceptor)mocks.CreateMock(typeof(IInterceptor)); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, expectedEntityInterceptor); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); Assert.AreSame(expectedSessionFactory, sss.SessionFactory); Assert.AreSame(expectedEntityInterceptor, sss.EntityInterceptor); }
public void CallingDefaultConstructorCausesLazyResolvingReferences() { MockRepository mocks = new MockRepository(); ISessionFactory expectedSessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); IInterceptor expectedEntityInterceptor = (IInterceptor)mocks.CreateMock(typeof(IInterceptor)); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, expectedEntityInterceptor); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); Assert.AreSame(expectedSessionFactory, sss.SessionFactory); Assert.AreSame(expectedEntityInterceptor, sss.EntityInterceptor); }
public void MissingEntityInterceptorIsOkDuringLazyResolving() { MockRepository mocks = new MockRepository(); ISessionFactory expectedSessionFactory = mocks.StrictMock<ISessionFactory>(); SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(expectedSessionFactory, null); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); Assert.AreSame(expectedSessionFactory, sss.SessionFactory); Assert.AreSame(null, sss.EntityInterceptor); }
public void MissingSessionFactoryCausesArgumentExceptionDuringLazyResolving() { SessionScopeSettings sss = new LazyResolvingSessionScopeSettings(null, null); // config values are set to their defaults Assert.AreEqual(SessionScopeSettings.SINGLESESSION_DEFAULT, sss.SingleSession); Assert.AreEqual(SessionScopeSettings.FLUSHMODE_DEFAULT, sss.DefaultFlushMode); ISessionFactory temp; Assert.Throws<ArgumentException>(() => temp = sss.SessionFactory); }