public void SetUp() { var builder = new ContainerBuilder(); _ravenDbContext = MockRepository.GenerateStub<IDatabaseContext>(); var stubDocumentSession = MockRepository.GenerateStub<IDocumentSession>(); _ravenDbContext.Stub(x => x.OpenSession()).Return(stubDocumentSession); builder.RegisterInstance(_ravenDbContext).As<IDatabaseContext>(); builder.RegisterModule<DatabaseSessionModule>(); base.BuildAndCreateTestDependencyResolver(builder); }