public void ServiceScanner_ShouldGetIScopedServiceT()
        {
            var res = ServicesScanner.GetImplementationsFiltered <IScopedService>(typeof(TestT2));

            Assert.Equal(typeof(TestT2), res.ImplementationType);
            Assert.Equal(typeof(IScopedServiceT), res.ImplementingInterfaces.Single());
        }
        public void ServiceScanner_NoImplementation_IncludeGivenType()
        {
            var res = ServicesScanner.GetImplementationsFiltered <IScopedService>(typeof(TestT), true);

            Assert.Equal(typeof(TestT), res.ImplementationType);
            Assert.Equal(typeof(IScopedService), res.ImplementingInterfaces.Single());
        }
        public void ServiceScanner_GenericsOpenClosed_ShouldGetBoth()
        {
            var res = ServicesScanner.GetImplementationsFiltered <ITransientService>(typeof(ImplementationGeneric <>));

            Assert.Equal(typeof(ImplementationGeneric <>), res.ImplementationType);
            Assert.Equal(typeof(IGeneric <>).GUID, res.ImplementingInterfaces.Single().GUID);
            Assert.Equal(typeof(IGeneric <>).Assembly, res.ImplementingInterfaces.Single().Assembly);
        }
        // todo: decide how to handle di overrides
        public static IServiceCollection RegisterServicesByConvention(this IServiceCollection services, params Type[] types)
        {
            services
            .RegisterSingletonServices(ServicesScanner.GetImplementationsFiltered <ISingletonService>(types))
            .RegisterHostedServices(ServicesScanner.GetImplementationsFiltered <IHostedServiceInterface>(types))
            .RegisterScopedServices(ServicesScanner.GetImplementationsFiltered <IScopedService>(types))
            .RegisterTransientServices(ServicesScanner.GetImplementationsFiltered <ITransientService>(types));

            return(services);
        }
        public void ServiceScanner_Double_Interface_ShouldGetBoth()
        {
            var res = ServicesScanner.GetImplementationsFiltered <IScopedService>(typeof(TestT4));

            Assert.Equal(typeof(TestT4), res.ImplementationType);
            Assert.Equal(typeof(IScopedServiceT), res.ImplementingInterfaces.Single());

            res = ServicesScanner.GetImplementationsFiltered <ITransientService>(typeof(TestT4));
            Assert.Equal(typeof(TestT4), res.ImplementationType);
            Assert.Equal(typeof(IServiceT), res.ImplementingInterfaces.Single());
        }
        public void ServiceScanner_NoImplementation_NotIncludeGivenType()
        {
            var res = ServicesScanner.GetImplementationsFiltered <IScopedService>(typeof(TestT), false);

            Assert.Null(res);
        }
        public void ServiceScanner_NoImplementation_NoneFound()
        {
            var res = ServicesScanner.GetImplementationsFiltered <IScopedService>(typeof(object));

            Assert.Null(res);
        }