Пример #1
0
        public void CanRegisterSetOfTypesWithNamedSuffix_AsAllSupportedInterfaces()
        {
            var catalog = new TypeCatalog(new ServiceCollection(), typeof(ComponentTwo));

            catalog.AsImplementedInterface("Two", ServiceLifetime.Scoped);

            Assert.Equal(1, catalog.Services.Count);
            Assert.True(catalog.Services.All(s => s.ImplementationType == typeof(ComponentTwo)));
            Assert.True(catalog.Services.All(s => s.Lifetime == ServiceLifetime.Scoped));
            Assert.Contains(catalog.Services, s => s.ServiceType == typeof(IComponentTwo));
        }