public void BootstrapDefaultTest() { bool eventHandlerCalled = false; DATContext.PreContainerBuild += (sender, builder) => { eventHandlerCalled = true; }; DATContext.Bootstrap(); DATConfiguration datConfiguration = DATContext.Container.Resolve <DATConfiguration>(); Assert.Equal("test-service", datConfiguration.Name); ILogger logger = DATContext.Container.Resolve <ILogger>(); Assert.NotNull(logger); Assert.True(eventHandlerCalled); }
static void Main(string[] args) { DATContext.PreContainerBuild += (sender, builder) => { builder.RegisterType <SampleService>(); builder.RegisterType <Handlers>(); // TODO: Add custom services }; DATContext.Bootstrap(); IContainer container = DATContext.Container; Handlers handlers = container.Resolve <Handlers>(); handlers.Setup(); }
public void BootstrapDefaultStagingTest() { Environment.SetEnvironmentVariable("NETCORE_ENVIRONMENT", "Staging"); bool eventHandlerCalled = false; DATContext.PreContainerBuild += (sender, builder) => { eventHandlerCalled = true; }; DATContext.Bootstrap(); DATConfiguration datConfiguration = DATContext.Container.Resolve <DATConfiguration>(); Assert.Equal("test-service-2", datConfiguration.Name); ILogger logger = DATContext.Container.Resolve <ILogger>(); Assert.NotNull(logger); Assert.True(eventHandlerCalled); }