public void StartAndStopAreNotReentrant() { using var watcher = new StatusWatcher(_jf); bool IsRunning() => watcher.GetPrivateField <bool>("_running"); Assert.False(IsRunning()); watcher.Start(); Assert.True(IsRunning()); watcher.Start(); Assert.True(IsRunning()); watcher.Stop(); Assert.False(IsRunning()); watcher.Stop(); Assert.False(IsRunning()); }
public async Task WatcherRaisesTheChangedEventOnStart() { using var watcher = new StatusWatcher(_jf); var ecs = new EventCollector <StatusEntry>(h => watcher.Changed += h, h => watcher.Changed -= h, nameof(WatcherRaisesTheChangedEventOnStart)); var status = await ecs.WaitAsync(() => { watcher.Start(); watcher.Stop(); }).ConfigureAwait(false); Assert.Equal("Status", status.Event); }
public void Stop() { if (!_running) { return; } _running = false; _modifierKeysWatcher.Stop(); _journalWatcher.Stop(); _statusWatcher.Stop(); _bindingsWatcher.Stop(); _graphicsConfig.Stop(); _gameProcessWatcher.Stop(); }