Пример #1
0
        public void CreatesComponentDependencies()
        {
            var result = new ComponentDependencyCreator().Create(typeof(MyClass));

            Assert.Single(result);
            Assert.Equal("lorem-ipsum", result.Single());
        }
Пример #2
0
        public IEnumerable <Component> Create()
        {
            var result = new List <Component>();

            foreach (var type in ComponentTypeProvider.GetTypes())
            {
                var attribute = type.GetCustomAttribute <ComponentAttribute>();

                if (attribute == null)
                {
                    continue;
                }

                result.Add(new Component(attribute.Id, new AssemblyWrapper(type.Assembly), ComponentDependencyCreator.Create(type), ComponentControllerCreator.Create(type), ScriptCreator.Create(attribute.Id, type), StyleCreator.Create(attribute.Id, type), ResourceCreator.Create(attribute.Id, type)));
            }

            if (Logger.IsEnabled(LogLevel.Information))
            {
                Logger.LogInformation($"Detected {result.Count} components: {string.Join(", ", result.Select(r => r.Id))}");
            }

            return(result);
        }