Ejemplo n.º 1
0
        public void DefaultMappingTest()
        {
            var container = new IocContainer();
            var service   = container.Get <IDefaultMappingService>();

            Assert.IsType <DefaultMappingService2>(service);
            container.DestroyAll();

            container.Add(typeof(IDefaultMappingService));
            service = container.Get <IDefaultMappingService>();
            Assert.IsType <DefaultMappingService2>(service);
            container.DestroyAll();

            container.Add(typeof(IDefaultMappingService), typeof(DefaultMappingService));
            service = container.Get <IDefaultMappingService>();
            Assert.IsType <DefaultMappingService>(service);
        }
Ejemplo n.º 2
0
        public void DefaultMappingTest2()
        {
            var container = new IocContainer();
            var service = container.GetService<DefaultMappingCtorService>();
            Assert.IsType<DefaultMappingService2>(service.InnerService);
            container.DestroyAll();

            container.AddService(typeof(IDefaultMappingService), typeof(DefaultMappingService));
            service = container.GetService<DefaultMappingCtorService>();
            Assert.IsType<DefaultMappingService>(service.InnerService);
        }