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); }
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); }