public void Setup() { _updater = new Mock <IAutoUpdater>(); _settings = new AutoUpdateSettings(); _dispatcher = new ManualDispatcher(); _viewModel = new AutoUpdateViewModel(_updater.Object, _settings, _dispatcher); }
public void Setup() { _dispatcher = new ManualDispatcher(); _viewTemplate = new AnalysisViewTemplate(); _analyser = new Mock <IAnalysis>(); _analysisStorage = new Mock <IAnalysisStorage>(); }
public void SetUp() { _settings = new ApplicationSettings("adwad"); _bookmarks = new Bookmarks("aawdwa"); _dispatcher = new ManualDispatcher(); _scheduler = new ManualTaskScheduler(); _logSourceFactory = new SimplePluginLogSourceFactory(_scheduler); _filesystem = new InMemoryFilesystem(); _dataSources = new DataSources(_logSourceFactory, _scheduler, _filesystem, _settings.DataSources, _bookmarks); _quickFilters = new QuickFilters(_settings.QuickFilters); _actionCenter = new ActionCenter(); _updater = new Mock <IAutoUpdater>(); _services = new ServiceContainer(); _services.RegisterInstance <ITaskScheduler>(_scheduler); _services.RegisterInstance <IDispatcher>(_dispatcher); _services.RegisterInstance <IPluginLoader>(new PluginRegistry()); _services.RegisterInstance <IHighlighters>(new HighlighterCollection()); _services.RegisterInstance <INavigationService>(new NavigationService()); _services.RegisterInstance <IPluginUpdater>(new Mock <IPluginUpdater>().Object); _mainWindow = new MainWindowViewModel(_services, _settings, _dataSources, _quickFilters, _actionCenter, _updater.Object); }
public void MultipleThreads() { ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue = dispatcher.CreateQueue(); Thread thread1 = new Thread(new ThreadStart(() => { ThreadWorkerA(queue); })); Thread thread2 = new Thread(new ThreadStart(() => { ThreadWorkerB(queue); })); // start the threads counter = 0; thread1.Start(); thread2.Start(); // spin waiting for threads to end while (thread1.IsAlive || thread2.IsAlive) { dispatcher.ProcessQueues(); } dispatcher.ProcessQueues(); Assert.IsTrue(counter == 30); }
public void DisposeDispatcherFirst() { ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue = dispatcher.CreateQueue(); dispatcher.Dispose(); Assert.IsNull(queue.Dispatcher); ((IDisposable)queue).Dispose(); }
public void Setup() { _dispatcher = new ManualDispatcher(); _viewTemplate = new AnalysisViewTemplate(); _analyser = new Mock <IAnalysis>(); _id = AnalysisId.CreateNew(); _analyser.Setup(x => x.Id).Returns(_id); _analysisStorage = new Mock <IAnalysisStorage>(); _pluginRegistry = new PluginRegistry(); }
public void Setup() { _settings = new Mock <IApplicationSettings>(); _mainWindow = new Mock <IMainWindowSettings>(); _settings.Setup(x => x.MainWindow).Returns(_mainWindow.Object); _dataSources = new Mock <IDataSources>(); _dispatcher = new ManualDispatcher(); _taskScheduler = new ManualTaskScheduler(); _analysisStorage = new Mock <IAnalysisStorage>(); }
public void DisposeQueueInsideAction() { ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue = dispatcher.CreateQueue(); queue.Enqueue(() => {}); queue.Enqueue(() => { ((IDisposable)queue).Dispose(); }); queue.Enqueue(() => {}); dispatcher.ProcessQueues(); dispatcher.Dispose(); }
public void DisposeQueueFirst() { ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue = dispatcher.CreateQueue(); string name = queue.Name; ((IDisposable)queue).Dispose(); Assert.IsNull(queue.Dispatcher); Assert.IsNull(dispatcher.GetQueueByName(name)); dispatcher.Dispose(); }
public void Setup() { _dispatcher = new ManualDispatcher(); _taskScheduler = new ManualTaskScheduler(); _analysisStorage = new Mock <IAnalysisStorage>(); _analyses = new List <IAnalysis>(); _analysisStorage.Setup(x => x.Analyses).Returns(_analyses); _templates = new Dictionary <AnalysisId, ActiveAnalysisConfiguration>(); _analysisStorage.Setup(x => x.CreateAnalysis(It.IsAny <AnalysisTemplate>(), It.IsAny <AnalysisViewTemplate>())) .Returns((AnalysisTemplate templates, AnalysisViewTemplate viewTemplate) => AddAnalysis()); _pluginRegistry = new PluginRegistry(); }
public void SetUp() { _dataSource = new SingleDataSourceViewModel(new SingleDataSource(_scheduler, new DataSource("Foobar") {Id = Guid.NewGuid()})); _control = new LogViewerControl { DataSource = _dataSource, Width = 1024, Height = 768 }; DispatcherExtensions.ExecuteAllEvents(); _dispatcher = new ManualDispatcher(); }
public void SimpleFunction() { ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue = dispatcher.CreateQueue(); counter = 0; for (int i = 0; i < 10; i++) { queue.Enqueue(IncrementCounter); } // all the actions should be processed dispatcher.ProcessQueues(); Assert.IsTrue(counter == 10); }
public void SimpleLambda() { ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue = dispatcher.CreateQueue(); int localCounter = 0; for (int i = 0; i < 10; i++) { queue.Enqueue(() => { localCounter += 1; }); } dispatcher.ProcessQueues(); Assert.IsTrue(localCounter == 10); }
public void SetUp() { _settings = new ApplicationSettings("adwad"); _dispatcher = new ManualDispatcher(); _scheduler = new ManualTaskScheduler(); _dataSources = new DataSources(_scheduler, _settings.DataSources); _quickFilters = new QuickFilters(_settings.QuickFilters); _actionCenter = new ActionCenter(); _updater = new Mock<IAutoUpdater>(); _mainWindow = new MainWindowViewModel(_settings, _dataSources, _quickFilters, _actionCenter, _updater.Object, _dispatcher); }
public void Setup() { _dispatcher = new ManualDispatcher(); _taskScheduler = new ManualTaskScheduler(); _analysisStorage = new Mock <IAnalysisStorage>(); _analysisStorage.Setup(x => x.CreateAnalysis(It.IsAny <AnalysisTemplate>(), It.IsAny <AnalysisViewTemplate>())) .Returns((AnalysisTemplate templates, AnalysisViewTemplate viewTemplate) => { var analysis = new Mock <IAnalysis>(); var id = AnalysisId.CreateNew(); analysis.Setup(x => x.Id).Returns(id); return(analysis.Object); }); _sidePanel = new AnalysesSidePanel(_dispatcher, _taskScheduler, _analysisStorage.Object); }
public void Setup() { _settings = new Mock <IApplicationSettings>(); _mainWindow = new Mock <IMainWindowSettings>(); _settings.Setup(x => x.MainWindow).Returns(_mainWindow.Object); _dataSources = new Mock <IDataSources>(); _dispatcher = new ManualDispatcher(); _taskScheduler = new ManualTaskScheduler(); _pluginRegistry = new PluginRegistry(); _analysisStorage = new Mock <IAnalysisStorage>(); _analysisStorage .Setup(x => x.CreateAnalysis(It.IsAny <AnalysisTemplate>(), It.IsAny <AnalysisViewTemplate>())) .Returns(() => { var analysis = new Mock <IAnalysis>(); var id = AnalysisId.CreateNew(); analysis.Setup(x => x.Id).Returns(id); return(analysis.Object); }); }
public void SetUp() { _settings = new ApplicationSettings("adwad"); _dispatcher = new ManualDispatcher(); _scheduler = new ManualTaskScheduler(); _logFileFactory = new PluginLogFileFactory(_scheduler); _dataSources = new DataSources(_logFileFactory, _scheduler, _settings.DataSources); _quickFilters = new QuickFilters(_settings.QuickFilters); _actionCenter = new ActionCenter(); _updater = new Mock <IAutoUpdater>(); _analysisStorage = new Mock <IAnalysisStorage>(); _mainWindow = new MainWindowViewModel(_settings, _dataSources, _quickFilters, _actionCenter, _updater.Object, _scheduler, _analysisStorage.Object, _dispatcher, new PluginRegistry()); }
public void NestedEnqueue() { ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue = dispatcher.CreateQueue(); counter = 0; for (int i = 0; i < 10; i++) { queue.Enqueue(() => { counter += 1; queue.Enqueue(IncrementCounter); }); } // the first 10 actions should be processed dispatcher.ProcessQueues(); Assert.IsTrue(counter == 10); // the secondary actions should be processed dispatcher.ProcessQueues(); Assert.IsTrue(counter == 20); }
public void CreateMultipleQueues() { // test CreateQueue - succeeds ManualDispatcher dispatcher = new ManualDispatcher(); IActionQueue queue1 = dispatcher.CreateQueue(); Assert.IsNotNull(queue1); Assert.IsNotNull(queue1.Name); Assert.IsTrue(queue1.Dispatcher == dispatcher); // test CreateQueue - succeeds again IActionQueue queue2 = dispatcher.CreateQueue(); Assert.IsNotNull(queue2); Assert.IsNotNull(queue2.Name); Assert.IsTrue(queue2.Dispatcher == dispatcher); // verify the two queues are different Assert.AreNotSame(queue1, queue2); Assert.IsTrue(queue1.Name != queue2.Name); // test GetQueueByName - succeeds IActionQueue a = dispatcher.GetQueueByName(queue1.Name); Assert.AreSame(queue1, a); // test GetQueueByName - succeeds IActionQueue b = dispatcher.GetQueueByName(queue2.Name); Assert.AreSame(queue2, b); // test GetQueueByName - fails IActionQueue c = dispatcher.GetQueueByName("not_found"); Assert.IsNull(c); }
public void Setup() { _dispatcher = new ManualDispatcher(); _actionCenter = new Tailviewer.BusinessLogic.ActionCenter.ActionCenter(); _viewModel = new ActionCenterViewModel(_dispatcher, _actionCenter); }
public void Setup() { _dispatcher = new ManualDispatcher(); _actionCenter = new Tailviewer.BusinessLogic.ActionCenter.ActionCenter(); _viewModel = new ActionCenterViewModel(_dispatcher, _actionCenter); }
public void SetUp() { _dispatcher = new ManualDispatcher(); }