public static void RegisterType <TService, TImplementation>(this Container container) { container.RegisterType(typeof(TService), null, typeof(TImplementation)); }
public void Container_RegisterType_Returns_Instance() { //Arrange var container = new Container(); var mock = new Mock<IService>(); var inst = mock.Object; container.Register<IService>((c, t, k) => inst); //Act container.RegisterType(typeof(IService2), null, typeof(Service2Impl)); var svc = container.GetInstance<IService2>(); //Assert Assert.AreSame(inst, svc.Service); }
public static void RegisterType <TService, TImplementation>(this Container container, string key) { container.RegisterType(typeof(TService), key, typeof(TImplementation)); }