public void CanRegisterSetOfFilteredTypes_AsSameServiceType() { var catalog = new TypeCatalog(new ServiceCollection(), typeof(ComponentOne), typeof(ComponentTwo)); catalog.AsService <ICommonComponent>( t => t.Name.StartsWith("Component", System.StringComparison.Ordinal), ServiceLifetime.Scoped); Assert.Equal(2, catalog.Services.Count); Assert.True(catalog.Services.All(s => s.ServiceType == typeof(ICommonComponent))); Assert.True(catalog.Services.All(s => s.Lifetime == ServiceLifetime.Scoped)); Assert.Contains(catalog.Services, s => s.ImplementationType == typeof(ComponentOne)); Assert.Contains(catalog.Services, s => s.ImplementationType == typeof(ComponentTwo)); }