public void Transient_Instances_Are_Unique() { var container = new IdiocyContainer(); container.Register<Component, IService>(); var service1 = container.Resolve<IService>(); var service2 = container.Resolve<IService>(); Assert.AreNotSame(service1, service2); }
public void Singleton_Instances_Are_Same() { var container = new IdiocyContainer(); container.Register<Component, IService>(Lifetime.Singleton); var service1 = container.Resolve<IService>(); var service2 = container.Resolve<IService>(); Assert.AreSame(service1, service2); }
public void Resolve_Concrete_Type() { var container = new IdiocyContainer(); container.Register<Component, IService>(); var component = container.Resolve<IService>(); Assert.AreEqual(typeof(Component), component.GetType()); }
public void Throw_If_Service_Not_Registered() { var container = new IdiocyContainer(); var component = container.Resolve<IServiceWithParams>(); }