public async Task InitialPositionBOS(bool polling)
        {
            var sink = new ListEventSink();
            var msg  = "A fresh message";

            // Write some events before the source is created
            for (var i = 0; i < 3; i++)
            {
                EventLog.WriteEntry(_logSource, msg, EventLogEntryType.Information);
            }

            await Task.Delay(100);

            var bm = new FileBookmarkManager(_bookmarkDir, NullLogger.Instance, _appDataFileProvider);

            var cts    = new CancellationTokenSource();
            var source = CreateSource(polling, LogName, bm, InitialPositionEnum.BOS);

            var subscription = source.Subscribe(sink);

            await bm.StartAsync(cts.Token);

            await source.StartAsync(cts.Token);

            await Task.Delay(1000);

            Assert.Equal(3, sink.Count);

            cts.Cancel();
            await source.StopAsync(default);
        public async Task SystemStart_DirectoryIsCreated()
        {
            if (Directory.Exists(_testDir))
            {
                Directory.Delete(_testDir, true);
                await Task.Delay(500);
            }

            // start the system
            var cts    = new CancellationTokenSource();
            var system = new FileBookmarkManager(_bookmarkDirName, NullLogger.Instance, _appDataFileProvider);
            await system.StartAsync(cts.Token);

            cts.Cancel();
            await system.StopAsync(default);