CreateWithExceptionStateless2() private method

private CreateWithExceptionStateless2 ( Blog blog ) : BlogItem
blog Blog
return BlogItem
        public void NonTransactionalRootStateless()
        {
            ISessionManager sessionManager = container.Resolve <ISessionManager>();

            ITransaction transaction;

            using (IStatelessSession session = sessionManager.OpenStatelessSession())
            {
                transaction = session.Transaction;

                Assert.IsFalse(transaction.IsActive);

                FirstDao  first  = container.Resolve <FirstDao>("myfirstdao");
                SecondDao second = container.Resolve <SecondDao>("myseconddao");

                // This call is transactional
                Blog blog = first.CreateStateless();

                // TODO: Assert transaction was committed
                // Assert.IsTrue(session.Transaction.WasCommitted);

                try
                {
                    second.CreateWithExceptionStateless2(blog);
                }
                catch (Exception)
                {
                    // Expected
                }

                // TODO: Assert transaction was rolledback
                // Assert.IsTrue(session.Transaction.WasRolledBack);

                RootService rootService = container.Resolve <RootService>();

                Array blogs = rootService.FindAllStateless(typeof(Blog));
                Assert.AreEqual(1, blogs.Length);
                Array blogitems = rootService.FindAllStateless(typeof(BlogItem));
                Assert.IsEmpty(blogitems);
            }
        }
示例#2
0
        public virtual void CallWithExceptionStateless2()
        {
            Blog blog = firstDao.CreateStateless();

            secondDao.CreateWithExceptionStateless2(blog);
        }