Provides methods that simplify service location and dependency resolution with a Unity container backing.
Inheritance: System.Web.Mvc.IDependencyResolver, System.Web.Http.Dependencies.IDependencyResolver
        public void Constructor()
        {
            ExceptionAssertEx.Throws<ArgumentNullException>(() => new UnityDependencyResolver(null));

            UnityContainer expectedUnityContainer = new UnityContainer();
            UnityDependencyResolver unityDependencyResolver = new UnityDependencyResolver(expectedUnityContainer);

            PrivateObject privateUnityDependencyResolver = new PrivateObject(unityDependencyResolver);
            object actualUnityContainer = privateUnityDependencyResolver.GetField("UnityContainer");

            Assert.IsNotNull(actualUnityContainer);
            Assert.AreEqual(expectedUnityContainer, actualUnityContainer);
        }
        public void GetServices()
        {
            UnityDependencyResolver unityDependencyResolver = CreateUnityDependencyResolver();

            Assert.IsNotNull(unityDependencyResolver.GetServices(typeof(ISomething)));
            Assert.IsTrue(unityDependencyResolver.GetServices(typeof(ISomething)).Count() == 1);

            Assert.IsNotNull(unityDependencyResolver.GetServices(typeof(IElse)));
            Assert.IsFalse(unityDependencyResolver.GetServices(typeof(IElse)).Any());

            Assert.IsNotNull(unityDependencyResolver.GetServices(typeof(IAnother)));
            Assert.IsFalse(unityDependencyResolver.GetServices(typeof(IAnother)).Any());

            // Test catch
            Mock<IUnityContainer> mockOf_IUnityContainer = new Mock<IUnityContainer>();
            mockOf_IUnityContainer.Setup(unityContainer => unityContainer.ResolveAll(It.IsAny<Type>())).Throws<Exception>();
            IEnumerable<object> services = new UnityDependencyResolver(mockOf_IUnityContainer.Object).GetServices(typeof(ISomething));
            Assert.IsNotNull(services);
            Assert.IsFalse(services.Any());
        }