public void Can_Resolve_Unbound_Generics() { var ioc = new IocContainer(); ioc.AddTransient <ILogger, Logger>(); ioc.AddTransient(typeof(IRepository <>), typeof(Repository <>)); var repo = ioc.Resolve <IRepository <Customer> >(); Assert.AreEqual(typeof(Repository <Customer>), repo.GetType()); }
public void Can_Resolve_Type_With_Parameters() { var ioc = new IocContainer(); ioc.AddTransient <ILogger, Logger>(); ioc.AddTransient <IRepository <Customer>, Repository <Customer> >(); var repo = ioc.Resolve <IRepository <Customer> >(); Assert.AreEqual(typeof(Repository <Customer>), repo.GetType()); }
public void Can_Resolve_Type() { var ioc = new IocContainer(); ioc.AddTransient <ILogger, Logger>(); var logger = ioc.Resolve <ILogger>(); Assert.AreEqual(typeof(Logger), logger.GetType()); }
private void ConfigureServices() { container.AddTransient <IWriter, ConsoleWriter>(); container.AddTransient <IReader, ConsoleReader>(); container.AddSingleton <ILogger, Logger.Logger>((Logger.Logger)GetLogger()); }