Пример #1
0
        public void PolymorphismWorks()
        {
            // setup
            _context.DeclareQualified <Door>("goldenDoor");
            _context.Declare <Palace>();
            _context.Declare(Janitor.MakeJanitor());

            // when
            _context.Resolve();
            var janitor = _context.Get <Janitor>();

            // then
            // a palace also is a house, so this janitor gets the palace
            Assert.IsNotNull(janitor.House);
        }
Пример #2
0
        public void TestLateInitWorks()
        {
            // setup
            _context.Declare <Door>();
            _context.Declare <House>();
            _context.Declare(Janitor.MakeJanitor());

            // when
            _context.Resolve();
            var janitor = _context.Get <Janitor>();

            // then
            Assert.NotNull(janitor);
            Assert.NotNull(janitor.House);
        }