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)); }
public void CustomProject_ToDataSource() { var bo = new BuildOutput(); var monitor = bo.GetProgressMonitor(); monitor.LogObject(new BuildSessionStartedEvent()); monitor.Log.Write("Custom project built"); monitor.LogObject(new BuildSessionFinishedEvent()); var nodes = bo.GetRootNodes(true); var dataSource = new BuildOutputDataSource(nodes); var child = dataSource.GetChild(dataSource.GetChild(null, 0), 0); Assert.That(dataSource.GetChildrenCount(null), Is.EqualTo(2)); Assert.That(child, Is.TypeOf(typeof(BuildOutputNode))); Assert.That((child as BuildOutputNode).Message, Is.EqualTo("Custom project built")); }