Пример #1
0
        static void Main(string[] args)
        {
            IocContainer.Configure();
            var programRunner = new ProgramService();

            programRunner.Execute();
        }
Пример #2
0
        public TestVehicle()
        {
            var services = new ServiceCollection();

            IocContainer.Configure(services);
            var provider = services.BuildServiceProvider();

            _services = provider.GetService <IServicesDO>();
        }
Пример #3
0
        /// <summary>
        /// Startup to load IoC container for the application.
        /// </summary>
        /// <param name="e">Event argument object</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            IocContainer.Configure();

            Current.MainWindow = new MainWindow();
            Current.MainWindow.Show();
        }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            //IocContainer.Register();
            IocContainer.Configure();
            //return;
            TestSugar();
        }
Пример #5
0
        static void Main(string[] args)
        {
            var services = new ServiceCollection();

            IocContainer.Configure(services);
            var provider = services.BuildServiceProvider();

            provider.GetService <ServicesApplication>();

            Thread.Sleep(Timeout.Infinite);
        }
Пример #6
0
        public void TestConfigureKeyedOptions()
        {
            var ioc = new IocContainer();

            ioc.Configure(new TestOptions
            {
                IntValue    = 5,
                StringValue = "TEST",
            });
            ioc.Configure("opt2", new TestOptions
            {
                IntValue    = 123,
                StringValue = "OTHER TEST"
            });

            var svc = ioc.Resolve <TestServiceWithKeyedConfig>();

            Assert.IsNotNull(svc.Configuration.Value);
            Assert.AreEqual(123, svc.Configuration.Value.IntValue);
            Assert.AreEqual("OTHER TEST", svc.Configuration.Value.StringValue);
        }
Пример #7
0
        public void TestConfigure()
        {
            var ioc = new IocContainer();

            ioc.Configure(new TestOptions
            {
                IntValue    = 5,
                StringValue = "TEST",
            });

            var svc = ioc.Resolve <TestService>();

            Assert.IsNotNull(svc.Configuration.Value);
            Assert.AreEqual(5, svc.Configuration.Value.IntValue);
            Assert.AreEqual("TEST", svc.Configuration.Value.StringValue);
        }