public void Raven_session_is_not_opened_before_on_action_executing()
        {
            var store = new TestableStore();
            var controller = new TestableController(store);

            Assert.Null(controller.Session);
        }
        public void If_no_exception_occurred_then_changes_are_saved()
        {
            var testDocument = new Foo { Id = "foos/123", Title = "foo" };

            var store = new TestableStore();

            var controller = new TestableController(store);

            StartActionExecuting(controller);

            using (var session = controller.Session)
            {
                session.Store(testDocument);
                session.SaveChanges();

                var doc = session.Load<Foo>(testDocument.Id);
                doc.Title = "bar";

                FinishActionExecuted(controller);
            }

            using (var session = store.OpenSession())
            {
                var doc = session.Load<Foo>(testDocument.Id);
                Assert.Equal("bar", doc.Title);
            }
        }
        public void Raven_session_is_opened_on_action_executing()
        {
            var store = new TestableStore();
            var controller = new TestableController(store);

            StartActionExecuting(controller);

            using (var session = controller.Session)
            {
                Assert.NotNull(session);
            }
        }