using System; using System.Collections.Generic; using Microsoft.AspNet.DependencyInjection; using Microsoft.AspNet.DependencyInjection.Fallback; namespace Microsoft.AspNet.Identity.Test { public static class TestServices { public static IServiceProvider DefaultServiceProvider() where TUser : class, IUser where TKey : IEquatable { var serviceCollection = new ServiceCollection {DefaultServices()}; return serviceCollection.BuildServiceProvider(); } public static IEnumerable DefaultServices() where TUser : class, IUser where TKey : IEquatable { return new IServiceDescriptor[] { new ServiceDescriptor(), new ServiceDescriptor, UserValidator>(), new ServiceDescriptor(), new ServiceDescriptor, ClaimsIdentityFactory>(), new ServiceDescriptor, NoopUserStore>() }; } public class ServiceDescriptor : IServiceDescriptor { public ServiceDescriptor(LifecycleKind lifecycle = LifecycleKind.Transient) { Lifecycle = lifecycle; } public LifecycleKind Lifecycle { get; private set; } public Type ServiceType { get { return typeof (TService); } } public Type ImplementationType { get { return typeof (TImplementation); } } public object ImplementationInstance { get { return null; } } } } }