示例#1
0
        public void GetServices_UnknownService_ReturnsEmptyEnumerable()
        {
            var container = CreateContainer();
            container.Register<IBar, Bar>();
            IDependencyResolver resolver = new LightInjectMvcDependencyResolver(container);

            var instances = resolver.GetServices<IFoo>();

            Assert.AreEqual(0, instances.Count());
        }
示例#2
0
        public void GetServices_MultipleServices_ReturnsAllInstances()
        {
            var container = CreateContainer();
            container.Register<IFoo, Foo>();
            container.Register<IFoo, AnotherFoo>("AnotherFoo");
            IDependencyResolver resolver = new LightInjectMvcDependencyResolver(container);

            var instances = resolver.GetServices<IFoo>();

            Assert.AreEqual(2, instances.Count());
        }