public void TestAdd1()
 {
     var results = new SearchResults();
     results.Add(1, new LogLineMatch(5, 42));
     results.Count.Should().Be(1);
     results.MatchesByLine[1].Should().Equal(new[] {new LogLineMatch(5, 42)});
 }
 public void TestClear1()
 {
     var results = new SearchResults();
     new Action(results.Clear).ShouldNotThrow();
     results.Count.Should().Be(0);
     results.Matches.Should().BeEmpty();
 }
        public void TestClear3()
        {
            var results = new SearchResults();
            results.Add(42, new LogLineMatch(1, 5));

            results.MatchesByLine[42].Should().NotBeEmpty();

            new Action(results.Clear).ShouldNotThrow();
            results.MatchesByLine[42].Should().BeEmpty();
        }
        public void TestClear2()
        {
            var results = new SearchResults();
            results.Add(42, new LogLineMatch(1, 5));

            results.Count.Should().Be(1);
            results.Matches.Should().Equal(new[] {new LogMatch(42, new LogLineMatch(1, 5))});

            new Action(results.Clear).ShouldNotThrow();
            results.Count.Should().Be(0);
            results.Matches.Should().BeEmpty();
        }
 public SearchResultsListener()
 {
     _results = new SearchResults();
 }
 public DispatchedSearchResults()
 {
     _actualResults = new SearchResults();
     _syncRoot      = new object();
 }
 public SearchResultsListener()
 {
     _results = new SearchResults();
 }
 public DispatchedSearchResults()
 {
     _actualResults = new SearchResults();
     _syncRoot = new object();
 }
        public void TestIncorrectSearchResult()
        {
            var textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Fatal), _hovered, _selected, true);
            var searchResults = new SearchResults();
            searchResults.Add(new LogLineIndex(0), new LogLineMatch(42, 101));

            new Action(() => textLine.SearchResults = searchResults).ShouldNotThrow();

            IEnumerable<TextSegment> segments = null;
            new Action(() => segments = textLine.Segments).ShouldNotThrow();

            segments.Should().NotBeEmpty();
            segments.Count().Should().Be(1);
            segments.ElementAt(0).Text.Should().Be("foobar", "because if, for some reason, highlighting doesn't work, then the original, non-highlithed, line should be displayed");
        }
Exemple #10
0
        public void TestHighlight5()
        {
            var results = new SearchResults();
            results.Add(new LogMatch(0, new LogLineMatch(28, 5)));

            var textLine = new TextLine(new LogLine(0, 0, ".NET Environment: 4.0.30319.42000", LevelFlags.None), _hovered,
                                        _selected, true)
            {
                SearchResults = results
            };

            textLine.Segments.Count().Should().Be(2);
            textLine.Segments.ElementAt(0).Text.Should().Be(".NET Environment: 4.0.30319.");
            textLine.Segments.ElementAt(1).Text.Should().Be("42000");
        }
Exemple #11
0
        public void TestHighlight3()
        {
            var textLine = new TextLine(new LogLine(0, 0, "foobar", LevelFlags.Fatal), _hovered, _selected, true);
            textLine.Segments.Count().Should().Be(1);
            textLine.Segments.First().FormattedText.Text.Should().Be("foobar");

            var results = new SearchResults();
            results.Add(new LogMatch(0, new LogLineMatch(1, 2)));
            textLine.SearchResults = results;
            var segments = textLine.Segments.ToList();
            segments.Count.Should().Be(3);
            segments[0].FormattedText.Text.Should().Be("f");
            segments[1].FormattedText.Text.Should().Be("oo");
            segments[2].FormattedText.Text.Should().Be("bar");
        }