예제 #1
0
        public void RegisterAndResolveTypeWithNestedDependency()
        {
            var container = new Container.Container();

            container.Register <ICar>(c => new Car());
            container.Register <IEngine>(c => new Engine(c.Resolve <ICar>()));

            var car    = container.Resolve <ICar>();
            var engine = container.Resolve <IEngine>();
        }
예제 #2
0
        public void RegisterAndResolveSimpleType()
        {
            var container = new Container.Container();

            container.Register <ICar>(c => new Car());

            var car = container.Resolve <ICar>();

            Assert.IsTrue(car is Car);
        }