public void WithFailDependencyContainer_ThrowsDependencyContainerRegistrationException() { var container = new DependencyContainer(); Assert.Throws <DependencyContainerRegistrationException>(() => container.AutoRegister(DependencyContainerDuplicateImplementationActions.Fail)); }
public void WithAssemblies_ResolvesIAnimal() { var container = new DependencyContainer(); container.AutoRegister(Runtime.GetAssemblies()); Assert.IsTrue(container.CanResolve <ICar>()); }
public void WithAssembliesAndRegisterMultiple_ResolvesICar() { var container = new DependencyContainer(); container.AutoRegister( Runtime.GetAssemblies(), DependencyContainerDuplicateImplementationActions.RegisterMultiple); Assert.IsTrue(container.CanResolve <ICar>()); }
public void WithNoParams_ThrowsDependencyContainerResolutionException() { Assert.Throws <DependencyContainerResolutionException>(() => { var container = new DependencyContainer(); container.AutoRegister(); Assert.IsTrue(container.CanResolve <ICar>()); Assert.AreEqual(new TheOnlyCar().Name, DependencyContainer.Current.Resolve <ICar>().Name); }); }
public void WithAssembliesAndFunc_ResolvesICar() { var container = new DependencyContainer(); container.AutoRegister( AppDomain.CurrentDomain.GetAssemblies(), DependencyContainerDuplicateImplementationAction.RegisterSingle, param => true); Assert.IsTrue(container.CanResolve <ICar>()); }