Пример #1
0
 protected override void invoke(Action action)
 {
     action();
     _session.SaveChanges();
     _session.WithOpenSession(x =>
                              _logger.DebugMessage(() =>
                                                   TransactionalBehaviorRavenSessionUsageMessage.For(x, _httpRequest)));
 }
        public void SetUp()
        {
            var advanced = MockRepository.GenerateMock<ISyncAdvancedSessionOperation>();
            advanced.Stub(x => x.NumberOfRequests).Return(10);
            var session = MockRepository.GenerateMock<IDocumentSession>();
            session.Stub(x => x.Advanced).Return(advanced);

            session.Advanced.NumberOfRequests.ShouldEqual(10);

            var request = new OwinHttpRequest();
            request.FullUrl("http://something/somethingelse");
            request.HttpMethod("GET");

            var currentPrincipal = new GenericPrincipal(new GenericIdentity("bob"), new string[0]);
            Thread.CurrentPrincipal = currentPrincipal;

            theMessage = TransactionalBehaviorRavenSessionUsageMessage.For(session, request);
        }