Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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);
        }