public void TestAddListener1()
        {
            Add("Hello World!");
            using (var search = new LogFileSearch(_scheduler, _logFile.Object, "l"))
            {
                search.AddListener(_listener.Object);

                _scheduler.RunOnce();

                _matches.Should().Equal(new[]
                    {
                        new LogMatch(0, new LogLineMatch(2, 1)),
                        new LogMatch(0, new LogLineMatch(3, 1)),
                        new LogMatch(0, new LogLineMatch(9, 1))
                    });
            }
        }
 private void DisposeCurrentSearch()
 {
     if (_currentSearch != null)
     {
         _currentSearch.Dispose();
         _currentSearch = null;
     }
 }
        private void CreateSearch()
        {
            DisposeCurrentSearch();

            var term = SearchTerm;
            _currentSearch = !string.IsNullOrEmpty(term) ? new LogFileSearch(_taskScheduler, _logFile, term, _maximumWaitTime) : null;
            _search.SearchTerm = SearchTerm;
        }
        public void TestCtor2()
        {
            Add("Hello World!");
            using (var search = new LogFileSearch(_scheduler, _logFile.Object, "l"))
            {
                _scheduler.RunOnce();

                search.Count.Should().Be(3);
                var matches = search.Matches.ToList();
                matches.Should().Equal(new[]
                    {
                        new LogMatch(0, new LogLineMatch(2, 1)),
                        new LogMatch(0, new LogLineMatch(3, 1)),
                        new LogMatch(0, new LogLineMatch(9, 1))
                    });
            }
        }
 public void TestCtor1()
 {
     using (var search = new LogFileSearch(_scheduler, _logFile.Object, "foobar"))
     {
         search.Matches.Should().BeEmpty("because the source is empty");
     }
 }
        public void TestDispose()
        {
            LogFileSearch search;
            using (search = new LogFileSearch(_scheduler, _logFile.Object, "foobar"))
            {
                search.IsDisposed.Should().BeFalse();
                _scheduler.PeriodicTaskCount.Should().Be(1);
            }

            search.IsDisposed.Should().BeTrue();
            _scheduler.PeriodicTaskCount.Should().Be(0);
        }