Exemplo n.º 1
0
        public void GetService_UnknownService_ReturnsNull()
        {
            var container = CreateContainer();
            IDependencyResolver resolver = new LightInjectWebApiDependencyResolver(container);

            var instance = resolver.GetService(typeof(IFoo));

            Assert.IsNull(instance);
        }
Exemplo n.º 2
0
        public void GetService_KnownService_ReturnsInstance()
        {
            var container = CreateContainer();

            container.Register <IFoo, Foo>();
            IDependencyResolver resolver = new LightInjectWebApiDependencyResolver(container);

            var instance = resolver.GetService(typeof(IFoo));

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