Ejemplo n.º 1
0
        public void GetService_UnknownService_ReturnsNull()
        {
            var container = CreateContainer();
            container.Register<IBar, Bar>();
            IDependencyResolver resolver = new LightInjectMvcDependencyResolver(container);

            var instance = resolver.GetService<IFoo>();

            Assert.IsNull(instance);
        }
Ejemplo n.º 2
0
        public void GetService_KnownService_ReturnsInstance()
        {
            var container = CreateContainer();
            container.Register<IFoo, Foo>();
            IDependencyResolver resolver = new LightInjectMvcDependencyResolver(container);

            var instance = resolver.GetService<IFoo>();

            Assert.IsInstanceOfType(instance, typeof(Foo));
        }