Beispiel #1
0
        public void TestAllComponents()
        {
            var assemblyCatalog = new AssemblyComponentCatalog(new[] { typeof(Components).Assembly });

            var expectedTypeNames = assemblyCatalog.Select(pair => pair.Item1.FullName + ";" + pair.Item2.GetType().FullName).OrderBy(name => name);
            var actualTypeNames   = Components.AllComponents.Select(t => t.Type.FullName + ";" + t.Instance.GetType().FullName).OrderBy(name => name);

            Assert.Equal(expectedTypeNames, actualTypeNames);
        }
Beispiel #2
0
        public void TestAllEdgeComponentsAdded()
        {
            var environmentSettings = _environmentSettingsHelper.CreateEnvironment(virtualize: true, loadDefaultGenerator: false);
            var componentManager    = new ComponentManager(
                new MockSettingsLoader(environmentSettings),
                new SettingsStore());

            var assemblyCatalog   = new AssemblyComponentCatalog(new[] { typeof(ComponentManager).Assembly });
            var expectedTypeNames = assemblyCatalog.Select(pair => pair.Value().FullName).OrderBy(name => name);

            var actualTypeNames = componentManager.ComponentCache.Values.SelectMany(t => t.Values).Select(o => o.GetType().FullName).OrderBy(name => name);

            Assert.Equal(expectedTypeNames, actualTypeNames);
            Assert.Equal(2, componentManager.OfType <IInstallerFactory>().Count());
        }