public void FlowTest() { var manager = new MiniSessionManager(); var session = manager.OpenSession(); var sessionNew = manager.OpenSession(); Assert.AreSame(session, sessionNew); manager.LastAction = RepositoryAction.INSERT; Assert.AreEqual(RepositoryAction.INSERT, manager.LastAction); manager.BeginTransaction(); manager.WillFlush = true; manager.CommitChanges(); }
public void GetOriginalEntityPropertyTest() { var manager = new MiniSessionManager(); var session = manager.OpenSession(); Assert.AreEqual(null, session.GetOriginalEntityProperty(new User(), "Name")); }
public void IsDirtyPropertyTest() { var manager = new MiniSessionManager(); var session = manager.OpenSession(); Assert.IsFalse(session.IsDirtyProperty(new User(), "Name")); }
public void IsDirtyEntityTest() { var manager = new MiniSessionManager(); var session = manager.OpenSession(); Assert.IsTrue(session.IsDirtyEntity(new User())); }
public void PrintSessionStatisticsTest() { var manager = new MiniSessionManager(); var session = manager.OpenSession(); session.PrintSessionStatistics(); }
public void IsPersistedTest() { var obj = new ObjectGraphWalker(); var manager = new MiniSessionManager(); var session = manager.OpenSession(); Assert.AreEqual(null, obj.IsPersisted(new User(), session)); }
public Repository(MiniSessionManager manager = null) { _sessionManager = manager; if (_sessionManager == null) { _sessionManager = MiniSessionManager.Instance; } // Make sure the session is open _sessionManager.OpenSession(); _currentSession = _sessionManager.Session; }
public void FlowExceptionTest() { var manager = new MiniSessionManager { Session = null }; Assert.ThrowsException <ApplicationException>(() => { manager.CommitChanges(); }); manager.CommitChanges(new Exception()); var session = manager.OpenSession(); var sessionNew = manager.OpenSession(); Assert.AreSame(session, sessionNew); manager.BeginTransaction(); manager.CommitChanges(new Exception()); }
public void AssociateGraphWithSessionTest() { var obj = new ObjectGraphWalker(); var manager = new MiniSessionManager(); var session = manager.OpenSession(); Assert.AreEqual(null, obj.IsPersisted(new User(), session)); var user = obj.AssociateGraphWithSession(new User(), manager); //Assert.AreEqual("", user.Name); }
private ISession GetCurrentSession() { // Make sure session is open _sessionManager.OpenSession(); return(_sessionManager.Session); }