Skip to content

Instantly share code, notes, and snippets.

@agross
Created March 13, 2009 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agross/78559 to your computer and use it in GitHub Desktop.
Save agross/78559 to your computer and use it in GitHub Desktop.
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