public void ThrowsTypeNotRegisteredException() { var dependencyResolverManager = new DependencyResolverManager(); var resolvedDependencyResolver = dependencyResolverManager.GetDependencyResolverForType(typeof(object)); ExceptionTester.CallMethodAndExpectException<TypeNotRegisteredException>(() => resolvedDependencyResolver.Resolve(typeof(IDummy))); }
public void ReturnsRegisteredDependencyResolverForRegisteredType() { var dependencyResolverManager = new DependencyResolverManager(); var dependencyResolver = new CatelDependencyResolver(new ServiceLocator()); dependencyResolverManager.RegisterDependencyResolverForType(typeof(object), dependencyResolver); var resolvedDependencyResolver = dependencyResolverManager.GetDependencyResolverForType(typeof(object)); Assert.IsTrue(ReferenceEquals(dependencyResolver, resolvedDependencyResolver)); }
public void ReturnsDefaultDependencyResolverForNonRegisteredType() { var dependencyResolverManager = new DependencyResolverManager(); var resolvedDependencyResolver = dependencyResolverManager.GetDependencyResolverForType(typeof(object)); Assert.IsTrue(ReferenceEquals(dependencyResolverManager.DefaultDependencyResolver, resolvedDependencyResolver)); }
public void ThrowsArgumentNullExceptionForNullType() { var dependencyResolverManager = new DependencyResolverManager(); ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => dependencyResolverManager.GetDependencyResolverForType(null)); }