protected AbstractDataSource(ITaskScheduler taskScheduler, DataSource settings, TimeSpan maximumWaitTime) { if (taskScheduler == null) { throw new ArgumentNullException(nameof(taskScheduler)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (settings.Id == DataSourceId.Empty) { throw new ArgumentException("settings.Id shall be set to an actually generated id"); } _taskScheduler = taskScheduler; _settings = settings; _maximumWaitTime = maximumWaitTime; _logSource = new LogSourceProxy(taskScheduler, maximumWaitTime); _search = new LogSourceSearchProxy(taskScheduler, _logSource, maximumWaitTime); _findAllLogSource = new LogSourceProxy(taskScheduler, maximumWaitTime); _findAllSearch = new LogSourceSearchProxy(taskScheduler, _findAllLogSource, maximumWaitTime); UpdateSearch(); UpdateFindAllSearch(); }
public void TestCtor1() { var source = new InMemoryLogSource(); using (var proxy = new LogSourceSearchProxy(_taskScheduler, source, TimeSpan.Zero)) { proxy.SearchTerm.Should().BeNull(); proxy.Count.Should().Be(0); } }
public void TestSearch1() { var source = new InMemoryLogSource(); source.AddEntry("Hello World!"); source.AddEntry("Foobar"); using (var proxy = new LogSourceSearchProxy(_taskScheduler, source, TimeSpan.Zero)) { proxy.SearchTerm = "foobar"; proxy.Property(x => x.Count).ShouldAfter(TimeSpan.FromSeconds(20)).Be(1, "because we should be able to search through the file in a few seconds"); proxy.Matches.Should().Equal(new[] { new LogMatch(1, new LogLineMatch(0, 6)) }); proxy.Count.Should().Be(1); } }