private IReadOnlyLogBuffer GetEntries(StreamingTextLogSource logSource, IReadOnlyList <LogLineIndex> sourceSection) { var readTask = Task.Factory.StartNew(() => logSource.GetEntries(sourceSection)); logSource.Property(x => x.HasPendingReadRequests).ShouldEventually().BeTrue(); _taskScheduler.RunOnce(); readTask.Wait(); //readTask.Wait(TimeSpan.FromSeconds(10)).Should().BeTrue("because the task should have been finished now that we've let the scheduler run"); return(readTask.Result); }
private IReadOnlyList <LogSourceModification> AddListener(StreamingTextLogSource logSource, int maxCount) { var listener = new Mock <ILogSourceListener>(); var modifications = new List <LogSourceModification>(); listener.Setup(x => x.OnLogFileModified(logSource, It.IsAny <LogSourceModification>())) .Callback((ILogSource _, LogSourceModification modification) => { modifications.Add(modification); }); logSource.AddListener(listener.Object, TimeSpan.Zero, maxCount); return(modifications); }
private IReadOnlyLogBuffer GetEntries(StreamingTextLogSource logSource) { return(GetEntries(logSource, new LogSourceSection(0, logSource.GetProperty(Properties.LogEntryCount)))); }