public void UseTheCurrentSessionContextToUnbindAndCloseTheSession() { var factory = Isolate.Fake.Instance <ISessionFactory>(); Isolate.WhenCalled(() => MvcApplication.GetSessionFactory("Test")).WillReturn(factory); ObjectFactory.Configure(x => x.For <ISessionFactory>().Use(factory)); var session = Isolate.Fake.Instance <ISession>(); Isolate.WhenCalled(() => CurrentSessionContext.Unbind(factory)).WillReturn(session); _attribute.OnActionExecuted(_executedContext); Isolate.Verify.WasCalledWithAnyArguments(() => CurrentSessionContext.Unbind(factory)); Isolate.Verify.WasCalledWithAnyArguments(() => session.Close()); }