Пример #1
0
        public async Task CustomProject_DataSearch()
        {
            var bo      = new BuildOutput();
            var monitor = bo.GetProgressMonitor();

            monitor.LogObject(new BuildSessionStartedEvent());
            for (int i = 0; i < 100; i++)
            {
                monitor.Log.WriteLine($"Message {i + 1}");
            }
            monitor.Log.WriteLine("Custom project built");
            monitor.LogObject(new BuildSessionFinishedEvent());

            var nodes      = bo.GetRootNodes(true);
            var dataSource = new BuildOutputDataSource(nodes);
            var search     = new BuildOutputDataSearch(nodes);
            int matches    = 0;
            var visited    = new HashSet <BuildOutputNode> ();

            for (var match = await search.FirstMatch("Message "); match != null; match = search.NextMatch())
            {
                if (visited.Contains(match))
                {
                    break;
                }

                visited.Add(match);
                matches++;
            }

            Assert.That(matches, Is.EqualTo(100));
        }
Пример #2
0
        public async Task CustomProject_DataSearch()
        {
            var bo = GenerateCustomBuild(1);

            var nodes   = bo.GetRootNodes(true);
            var search  = new BuildOutputDataSearch(nodes);
            int matches = 0;
            var visited = new HashSet <BuildOutputNode> ();

            for (var match = await search.FirstMatch("Message "); match != null; match = search.NextMatch())
            {
                if (visited.Contains(match))
                {
                    break;
                }

                visited.Add(match);
                matches++;
            }

            Assert.That(matches, Is.EqualTo(1000));
        }