using ConsoleMonster; using ConsoleMonster.Layout; using ConsoleMonster.Presenters; using ConsoleMonster.Widgets; // A fixture shaped like assessment results. It never contacts the sample hosts. CheckResult[] checks = new CheckResult[] { new("Replication", "dc-west-01", "Pass", "All partners responded"), new("Disk capacity", "dc-west-01", "Warn", "14% free on the system volume"), new("Name resolution", "dc-east-02", "Fail", "No DNS response before the deadline") }; var table = Table.For(checks) .Column(check => check.Check) .Column(check => check.Target) .Column(check => check.Status, column => column.Presenter = CellPresenters.StatusWord) .Column(check => check.Detail); table.Expand = true; string source = ("# Check fixture\nfunction Test-NameResolution {\n param([string] $Target)\n " + "Resolve-DnsName -Name $Target -ErrorAction Stop\n}"); var excerpt = CodeView.FromLines(source, 2, 5, "PowerShell"); excerpt.Title = "Name resolution check"; excerpt.HighlightLines(4); Rows report = new Rows(new Rule("[accent bold]Assessment review[/]"), table, excerpt) { Gap = 1 }; Terminal.Write(report); record CheckResult(string Check, string Target, string Status, string Detail);