Created
March 13, 2009 13:29
-
-
Save agross/78559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Indigo.Runtime.Persistence; | |
using Machine.Specifications; | |
using NHibernate; | |
using NHibernate.Cfg; | |
using Rhino.Mocks; | |
namespace Indigo.Runtime.Tests.Persistence | |
{ | |
public class With_initializer | |
{ | |
protected static Configuration Configuration; | |
protected static SetInterceptorNHibernateInitializationAware SetInterceptor; | |
protected static IInterceptor Interceptor; | |
Establish context = () => | |
{ | |
Configuration = new Configuration(); | |
Interceptor = MockRepository.GenerateStub<IInterceptor>(); | |
}; | |
Because of = () => SetInterceptor.Configured(Configuration); | |
} | |
[Subject(typeof(SetInterceptorNHibernateInitializationAware))] | |
public class When_an_NHibernate_interceptor_is_set : With_initializer | |
{ | |
Establish context = () => | |
{ | |
SetInterceptor = new SetInterceptorNHibernateInitializationAware { Interceptor = Interceptor }; | |
}; | |
It should_set_the_interceptor = () => Configuration.Interceptor.ShouldEqual(Interceptor); | |
} | |
[Subject(typeof(SetInterceptorNHibernateInitializationAware))] | |
public class When_no_NHibernate_interceptor_is_set : With_initializer | |
{ | |
Establish context = () => | |
{ | |
SetInterceptor = new SetInterceptorNHibernateInitializationAware { Interceptor = null }; | |
}; | |
It should_not_set_an_interceptor = () => Configuration.Interceptor.ShouldBeOfType<EmptyInterceptor>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment