Skip to content

Instantly share code, notes, and snippets.

Blazey Software blazey

Block or report user

Report or block blazey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
blazey / InstallScheduler.cs
Created Jun 18, 2015
Conventional configuration and explicit configuration.
View InstallScheduler.cs
public class InstallScheduler : IWindsorInstaller
public void Install(IWindsorContainer container, IConfigurationStore store)
new InstallFeature<IScheduleCollectionFromAgent>().Install(container, store);
JobActivator.Current = new WindsorJobActivator(container.Kernel);
blazey / InstallFeature.cs
Last active Sep 16, 2015
Install features by namespace
View InstallFeature.cs
internal class InstallFeature<TInSameNamespaceAs> : IWindsorInstaller
public void Install(IWindsorContainer container, IConfigurationStore store)
.Unless(type => type.IsAssignableToGenericType(typeof (IEventHandler<>)))
.Unless(type => type.IsAssignableToGenericType(typeof (IResourceCommandHandler<>))
.Unless(type => typeof (Now).IsAssignableFrom(type))
.Unless(type => typeof (IWindsorInstaller).IsAssignableFrom(type))
blazey / InstallApi.cs
Created Jun 18, 2015
Installer example
View InstallApi.cs
public class InstallApi : IWindsorInstaller
public void Install(IWindsorContainer container, IConfigurationStore store)
new InstallFeature<IController>().Install(container, store);
blazey / Bootstrap.cs
Created Jun 18, 2015
Bootstrap example
View Bootstrap.cs
public class Bootstrap : IDisposable
private readonly Lazy<IWindsorContainer> _container = new Lazy<IWindsorContainer>(() =>
var container = new WindsorContainer();
return container;
blazey / RegisterComponent.cs
Created Jun 18, 2015
Windsor facility to swap registered components with configured test friendly substitutions.
View RegisterComponent.cs
internal class RegisterComponent<TService> where TService : class
private readonly Func<TService> _factory;
private readonly Type _componentType;
public static void Register(IWindsorContainer container, Func<TService> factory, Type componentType)
if (null == componentType)
new RegisterComponent<TService>(factory).Register(container);
blazey / Spec.cs
Last active Aug 29, 2015
Enabling in-memory integration tests by swapping out components in tests, post normal registration of components in container
View Spec.cs
_bootstrap = new Bootstrap();
_bootstrap.AddFacility<TestSubstituteFacility>(config =>
.Substitute<IDataLakeWriter>(sub => sub.Instance(_dataLakeWriterMockery.Mock))
.Substitute<ICollectorAgentDispatcher>(sub => sub.Stub())
.Substitute<IBackgroundJobClient>(sub => sub.Stub())
.Substitute<ISchedulesReportWriter>(sub => sub.Stub())
.Substitute<IRepository<Resource>>(sub => sub.Instance(() =>
You can’t perform that action at this time.