public void ThrowsArgumentNullExceptionForNullInstance() { var dependencyResolverManager = new DependencyResolverManager(); var dependencyResolver = new CatelDependencyResolver(new ServiceLocator()); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => dependencyResolverManager.RegisterDependencyResolverForType(null, dependencyResolver)); }
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 ReturnsRegisteredDependencyResolverForRegisteredInstance() { var dependencyResolverManager = new DependencyResolverManager(); var dependencyResolver = new CatelDependencyResolver(new ServiceLocator()); var myObject = new object(); dependencyResolverManager.RegisterDependencyResolverForInstance(myObject, dependencyResolver); var resolvedDependencyResolver = dependencyResolverManager.GetDependencyResolverForInstance(myObject); Assert.IsTrue(ReferenceEquals(dependencyResolver, resolvedDependencyResolver)); }