This file contains 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
public class InstallScheduler : IWindsorInstaller | |
{ | |
public void Install(IWindsorContainer container, IConfigurationStore store) | |
{ | |
new InstallFeature<IScheduleCollectionFromAgent>().Install(container, store); | |
container.Register( | |
Component.For<IBackgroundJobClient>().ImplementedBy<BackgroundJobClient>()); | |
JobActivator.Current = new WindsorJobActivator(container.Kernel); |
This file contains 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
internal class InstallFeature<TInSameNamespaceAs> : IWindsorInstaller | |
{ | |
public void Install(IWindsorContainer container, IConfigurationStore store) | |
{ | |
container.Register(Classes.FromThisAssembly() | |
.InSameNamespaceAs<TInSameNamespaceAs>() | |
.Unless(type => type.IsAssignableToGenericType(typeof (IEventHandler<>))) | |
.Unless(type => type.IsAssignableToGenericType(typeof (IResourceCommandHandler<>)) | |
.Unless(type => typeof (Now).IsAssignableFrom(type)) | |
.Unless(type => typeof (IWindsorInstaller).IsAssignableFrom(type)) |
This file contains 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
public class InstallApi : IWindsorInstaller | |
{ | |
public void Install(IWindsorContainer container, IConfigurationStore store) | |
{ | |
new InstallFeature<IController>().Install(container, store); | |
} | |
} |
This file contains 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
public class Bootstrap : IDisposable | |
{ | |
private readonly Lazy<IWindsorContainer> _container = new Lazy<IWindsorContainer>(() => | |
{ | |
var container = new WindsorContainer(); | |
container.Install(FromAssembly.This()); | |
container.Register(Component.For<IWindsorContainer>().Instance(container)); | |
return container; | |
}); |
This file contains 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
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); |
This file contains 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
_bootstrap = new Bootstrap(); | |
_bootstrap.AddFacility<TestSubstituteFacility>(config => | |
{ | |
config.WithContainer(_bootstrap.Container) | |
.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(() => |