示例#1
0
        public void Setup()
        {
            _typeFactory = new TypeFactory();
            _typeFactory.Add("EmptyType", typeof(EmptyType));
            _typeFactory.Add("SomeType", typeof(SomeType));

            _stream = new MemoryStream();
            _writer = new Writer(_stream, _typeFactory);
        }
示例#2
0
        private static ITypeFactory CreateTypeFactory(IPluginLoader pluginLoader)
        {
            var factory = new TypeFactory();

            foreach (var pair in pluginLoader.ResolveSerializableTypes())
            {
                factory.Add(pair.Key, pair.Value);
            }
            factory.Add <Core.QuickFiltersSettings>();
            factory.Add <QuickFilterSettings>();
            factory.Add <QuickFilterId>();
            return(factory);
        }
示例#3
0
        public void Setup()
        {
            _taskScheduler = new ManualTaskScheduler();
            _filesystem    = new InMemoryFilesystem(new ImmediateTaskScheduler());

            var root = Path.GetPathRoot(Constants.AnalysisDirectory);

            _filesystem.AddRoot(root);

            _logAnalyserEngine = new Mock <ILogAnalyserEngine>();

            _typeFactory = new TypeFactory();
            _typeFactory.Add(typeof(ActiveAnalysisConfiguration));
            _typeFactory.Add(typeof(AnalyserTemplate));
            _typeFactory.Add(typeof(PageTemplate));
            _typeFactory.Add(typeof(WidgetTemplate));
        }
示例#4
0
        public void TestTryGetTypeName()
        {
            var factory = new TypeFactory();

            var name = "MyCustomQuickFilterId";

            factory.Add(name, typeof(QuickFilterId));
            factory.TryGetTypeName(typeof(QuickFilterId)).Should().Be(name);
        }
示例#5
0
        public void TestTryCreateRegisteredType()
        {
            var factory = new TypeFactory();

            var name = "dwaawkdwanwaw";

            factory.Add(name, typeof(QuickFilterId));
            factory.TryCreateNew(name).Should().BeOfType <QuickFilterId>();
        }
示例#6
0
文件: App.cs 项目: ValRCS/Tailviewer
        private static ITypeFactory CreateTypeFactory(IEnumerable <ILogAnalyserPlugin> plugins)
        {
            var factory = new TypeFactory();

            foreach (var plugin in plugins)
            {
                foreach (var pair in plugin.SerializableTypes)
                {
                    try
                    {
                        factory.Add(pair.Key, pair.Value);
                    }
                    catch (Exception e)
                    {
                        Log.ErrorFormat("Caught unexpected exception: {0}", e);
                    }
                }
            }
            factory.Add(typeof(ActiveAnalysisConfiguration));
            factory.Add(typeof(AnalyserTemplate));
            factory.Add(typeof(PageTemplate));
            factory.Add(typeof(WidgetTemplate));
            return(factory);
        }
示例#7
0
        public void Setup()
        {
            _taskScheduler = new ManualTaskScheduler();
            _filesystem    = new InMemoryFilesystem(new ImmediateTaskScheduler());

            var root = Path.GetPathRoot(Constants.AnalysisDirectory);

            _filesystem.AddRoot(root);

            _dataSourceAnalyserEngine = new Mock <IDataSourceAnalyserEngine>();

            _typeFactory = new TypeFactory();
            _typeFactory.Add <AnalysisTemplate>();
            _typeFactory.Add <AnalysisViewTemplate>();
            _typeFactory.Add <ActiveAnalysisConfiguration>();
            _typeFactory.Add <AnalyserTemplate>();
            _typeFactory.Add <PageTemplate>();
            _typeFactory.Add <WidgetTemplate>();
        }
示例#8
0
        private static ITypeFactory CreateTypeFactory(IPluginLoader pluginLoader)
        {
            var factory = new TypeFactory();

            foreach (var pair in pluginLoader.ResolveSerializableTypes())
            {
                factory.Add(pair.Key, pair.Value);
            }
            factory.Add <AnalysisTemplate>();
            factory.Add <AnalysisViewTemplate>();
            factory.Add <ActiveAnalysisConfiguration>();
            factory.Add <AnalyserTemplate>();
            factory.Add <PageTemplate>();
            factory.Add <HorizontalWidgetLayoutTemplate>();
            factory.Add <ColumnWidgetLayoutTemplate>();
            factory.Add <RowWidgetLayoutTemplate>();
            factory.Add <WidgetTemplate>();
            factory.Add <Core.Settings.QuickFilters>();
            factory.Add <QuickFilter>();
            factory.Add <QuickFilterId>();
            return(factory);
        }