示例#1
0
        public WinFormium Build()
        {
            ILogger logger;

            if (_container.IsRegistered <ILogger>())
            {
                logger = _container.GetInstance <ILogger>();
            }
            else
            {
                logger = new DefaultLogger();
                _container.RegisterInstance(logger);
            }

            _context.Properties[typeof(ILogger)] = logger;

            return(new WinFormium(new Runtime(_options)));
        }
示例#2
0
        public void can_add_a_type_handler()
        {
            container.AddHandler(typeof(ITestService), () => new TestService());

            container.IsRegistered(typeof(ITestService)).ShouldBeTrue();
        }