private static IServiceCollection AddModuleCore(this IServiceCollection services)
 => services.Any(x => x.ServiceType == typeof(ModuleMarkup))
         ? services
         : services.AddSingleton <IEnumerable <ITypesProvider> >(_ => DependencyAssemblyProvider.GetAssemblies().Select(x => new AssemblyPart(x)))
 .AddScoped <IModuleStore, ModuleStore>()
 .AddScoped <IModuleProvider, DefaultModuleProvider>()
 .AddSingleton <ModuleMarkup>();
Beispiel #2
0
        public void AssemblyProvider_GetAssemblies_AreSameWithDependencyModel()
        {
            var expect = DependencyContext.Default.GetDefaultAssemblyNames();

            var actual = DependencyAssemblyProvider.GetAssemblies().Select(x => x.GetName());

            Assert.Equal(expect.Count(), actual.Count());

            Assert.All(expect.OrderBy(x => x.Name)
                       .Zip(actual.OrderBy(x => x.Name),
                            (l, r) => (l, r)), x => Assert.Equal(x.l.Name, x.r.Name));
        }