Exemple #1
0
        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();
        }
Exemple #2
0
        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());
        }