mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-02 19:08:15 +08:00
Change IAnsiConsole to render IRenderable
This makes it possible for encoders to output better representation of the actual objects instead of working with chopped up segments. * IAnsiConsole.Write now takes an IRenderable instead of segments * Calculating cell width does no longer require a render context * Removed RenderContext.LegacyConsole * Removed RenderContext.Encoding * Added Capabilities.Unicode
This commit is contained in:

committed by
Phil Scott

parent
2ba6da3514
commit
20650f1e7e
@ -1,10 +1,10 @@
|
||||
<pre style="font-size:90%;font-family:consolas,'Courier New',monospace">
|
||||
<span>┌─────────────────┬───────┬─────┐</span>
|
||||
<span>│ </span><span style="color: #FF0000;background-color: #000000">Foo</span><span> │ </span><span style="color: #008000;font-weight: bold;font-style: italic">Bar</span><span> │ </span><span style="color: #0000FF">Qux</span><span> │</span>
|
||||
<span>│</span><span> </span><span style="color: #FF0000;background-color: #000000">Foo</span><span> </span><span> </span><span>│</span><span> </span><span style="color: #008000;font-weight: bold;font-style: italic">Bar</span><span> </span><span> </span><span>│</span><span> </span><span style="color: #0000FF">Qux</span><span> </span><span>│</span>
|
||||
<span>├─────────────────┼───────┼─────┤</span>
|
||||
<span>│ </span><span style="text-decoration: underline">Corgi</span><span> │ </span><span style="font-weight: bold;font-style: italic;text-decoration: line-through">Waldo</span><span> │ </span><span style="color: #7F7F7F">Zap</span><span> │</span>
|
||||
<span>│ </span><span style="color: #FF0000">╭─────────────╮</span><span> │ │ │</span>
|
||||
<span>│ </span><span style="color: #FF0000">│</span><span> </span><span style="color: #0000FF">Hello World</span><span> </span><span style="color: #FF0000">│</span><span> │ │ │</span>
|
||||
<span>│ </span><span style="color: #FF0000">╰─────────────╯</span><span> │ │ │</span>
|
||||
<span>│</span><span> </span><span style="text-decoration: underline">Corgi</span><span> </span><span> </span><span>│</span><span> </span><span style="font-weight: bold;font-style: italic;text-decoration: line-through">Waldo</span><span> </span><span>│</span><span> </span><span style="color: #7F7F7F">Zap</span><span> </span><span>│</span>
|
||||
<span>│</span><span> </span><span style="color: #FF0000">╭</span><span style="color: #FF0000">─────────────</span><span style="color: #FF0000">╮</span><span> </span><span>│</span><span> </span><span> </span><span> </span><span>│</span><span> </span><span> </span><span> </span><span>│</span>
|
||||
<span>│</span><span> </span><span style="color: #FF0000">│</span><span> </span><span style="color: #0000FF">Hello</span><span style="color: #0000FF"> </span><span style="color: #0000FF">World</span><span> </span><span style="color: #FF0000">│</span><span> </span><span>│</span><span> </span><span> </span><span> </span><span>│</span><span> </span><span> </span><span> </span><span>│</span>
|
||||
<span>│</span><span> </span><span style="color: #FF0000">╰</span><span style="color: #FF0000">─────────────</span><span style="color: #FF0000">╯</span><span> </span><span>│</span><span> </span><span> </span><span> </span><span>│</span><span> </span><span> </span><span> </span><span>│</span>
|
||||
<span>└─────────────────┴───────┴─────┘</span>
|
||||
</pre>
|
@ -18,7 +18,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new BarChart()
|
||||
console.Write(new BarChart()
|
||||
.Width(60)
|
||||
.Label("Number of fruits")
|
||||
.AddItem("Apple", 12)
|
||||
@ -37,7 +37,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new BarChart()
|
||||
console.Write(new BarChart()
|
||||
.Width(60)
|
||||
.Label("Number of fruits")
|
||||
.AddItem("Apple", 0)
|
||||
|
@ -37,7 +37,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = Fixture.GetPanel().NoBorder();
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -69,7 +69,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = Fixture.GetPanel().AsciiBorder();
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -101,7 +101,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = Fixture.GetPanel().DoubleBorder();
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -133,7 +133,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = Fixture.GetPanel().HeavyBorder();
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -162,7 +162,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = Fixture.GetPanel().RoundedBorder();
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -191,7 +191,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = Fixture.GetPanel().SquareBorder();
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -19,7 +19,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var chart = Fixture.GetChart();
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -34,7 +34,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var chart = Fixture.GetChart().Width(60);
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -52,7 +52,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.UseValueFormatter((v, c) => string.Format(c, "{0}%", v));
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -67,7 +67,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var chart = Fixture.GetChart().Width(60).HideTags();
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -82,7 +82,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var chart = Fixture.GetChart().Width(60).HideTagValues();
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -97,7 +97,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var chart = Fixture.GetChart().Width(60).Culture("sv-SE");
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -112,7 +112,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var chart = Fixture.GetChart().Width(60).FullSize();
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -127,7 +127,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var chart = Fixture.GetChart().Width(60).FullSize();
|
||||
|
||||
// When
|
||||
console.Render(chart);
|
||||
console.Write(chart);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
|
@ -23,7 +23,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.AddCalendarEvent(new DateTime(2020, 10, 12));
|
||||
|
||||
// When
|
||||
console.Render(calendar);
|
||||
console.Write(calendar);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -42,7 +42,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.AddCalendarEvent(new DateTime(2020, 10, 12));
|
||||
|
||||
// When
|
||||
console.Render(calendar);
|
||||
console.Write(calendar);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -61,7 +61,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.AddCalendarEvent(new DateTime(2020, 10, 12));
|
||||
|
||||
// When
|
||||
console.Render(calendar);
|
||||
console.Write(calendar);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -80,7 +80,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.AddCalendarEvent(new DateTime(2020, 10, 12));
|
||||
|
||||
// When
|
||||
console.Render(calendar);
|
||||
console.Write(calendar);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -99,7 +99,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.AddCalendarEvent(new DateTime(2020, 10, 12));
|
||||
|
||||
// When
|
||||
console.Render(calendar);
|
||||
console.Write(calendar);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -50,7 +50,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
canvas.SetPixel(4, 4, Color.Yellow);
|
||||
|
||||
// When
|
||||
console.Render(canvas);
|
||||
console.Write(canvas);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -67,7 +67,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.SetPixel(1, 1, Color.Grey));
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -84,7 +84,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
canvas.SetPixel(19, 9, Color.Grey);
|
||||
|
||||
// When
|
||||
console.Render(canvas);
|
||||
console.Write(canvas);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -101,7 +101,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
canvas.SetPixel(19, 9, Color.Aqua);
|
||||
|
||||
// When
|
||||
console.Render(canvas);
|
||||
console.Write(canvas);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -117,7 +117,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
canvas.SetPixel(19, 1, Color.Grey);
|
||||
|
||||
// When
|
||||
console.Render(canvas);
|
||||
console.Write(canvas);
|
||||
|
||||
// Then
|
||||
console.Output.ShouldBeEmpty();
|
||||
|
@ -39,7 +39,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
}
|
||||
|
||||
// When
|
||||
console.Render(new Columns(cards));
|
||||
console.Write(new Columns(cards));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -20,7 +20,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var text = new FigletText(font, "Patrik was here");
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -35,7 +35,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var text = new FigletText(FigletFont.Default, "Patrik was here");
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -50,7 +50,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var text = new FigletText(FigletFont.Default, "Spectre.Console");
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -66,7 +66,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.Alignment(Justify.Left);
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -82,7 +82,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.Alignment(Justify.Center);
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
@ -98,7 +98,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.Alignment(Justify.Right);
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
await Verifier.Verify(console.Output);
|
||||
|
@ -96,7 +96,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
grid.AddEmptyRow();
|
||||
|
||||
// When
|
||||
console.Render(grid);
|
||||
console.Write(grid);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -117,7 +117,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
grid.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(grid);
|
||||
console.Write(grid);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -136,7 +136,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
grid.AddRow(" [blue]-c[/], [blue]--configuration[/]", "The configuration to run for.\nThe default for most projects is [green]Debug[/].");
|
||||
|
||||
// When
|
||||
console.Render(grid);
|
||||
console.Write(grid);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -157,7 +157,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
grid.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(grid);
|
||||
console.Write(grid);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -176,7 +176,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
grid.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(grid);
|
||||
console.Write(grid);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -197,7 +197,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
grid.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(grid);
|
||||
console.Write(grid);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -66,7 +66,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var markup = new Markup("Hello [[ World ]] !");
|
||||
|
||||
// When
|
||||
console.Render(markup);
|
||||
console.Write(markup);
|
||||
|
||||
// Then
|
||||
console.Output.ShouldBe("Hello [ World ] !");
|
||||
@ -82,7 +82,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var markup = new Markup(input);
|
||||
|
||||
// When
|
||||
console.Render(markup);
|
||||
console.Write(markup);
|
||||
|
||||
// Then
|
||||
console.Output.ShouldBe(output);
|
||||
|
@ -23,7 +23,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Corgi", "Waldo");
|
||||
|
||||
// When
|
||||
console.Render(new Padder(table).Padding(1, 2, 3, 4));
|
||||
console.Write(new Padder(table).Padding(1, 2, 3, 4));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -42,7 +42,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Corgi", "Waldo");
|
||||
|
||||
// When
|
||||
console.Render(new Padder(table)
|
||||
console.Write(new Padder(table)
|
||||
.Padding(1, 2, 3, 4)
|
||||
.Expand());
|
||||
|
||||
@ -64,7 +64,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.Padding(2, 1));
|
||||
|
||||
// When
|
||||
console.Render(new Padder(table)
|
||||
console.Write(new Padder(table)
|
||||
.Padding(1, 2, 3, 4)
|
||||
.Expand());
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel(new Text("Hello World")));
|
||||
console.Write(new Panel(new Text("Hello World")));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -34,7 +34,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel(new Text("Hello World"))
|
||||
console.Write(new Panel(new Text("Hello World"))
|
||||
{
|
||||
Padding = new Padding(0, 0, 0, 0),
|
||||
});
|
||||
@ -51,7 +51,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel(new Text("Hello World"))
|
||||
console.Write(new Panel(new Text("Hello World"))
|
||||
{
|
||||
Padding = new Padding(3, 1, 5, 2),
|
||||
});
|
||||
@ -68,7 +68,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel("Hello World")
|
||||
console.Write(new Panel("Hello World")
|
||||
{
|
||||
Header = new PanelHeader("Greeting"),
|
||||
Expand = true,
|
||||
@ -87,7 +87,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel("Hello World")
|
||||
console.Write(new Panel("Hello World")
|
||||
{
|
||||
Header = new PanelHeader("Greeting").LeftAligned(),
|
||||
Expand = true,
|
||||
@ -105,7 +105,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel("Hello World")
|
||||
console.Write(new Panel("Hello World")
|
||||
{
|
||||
Header = new PanelHeader("Greeting").Centered(),
|
||||
Expand = true,
|
||||
@ -123,7 +123,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel("Hello World")
|
||||
console.Write(new Panel("Hello World")
|
||||
{
|
||||
Header = new PanelHeader("Greeting").RightAligned(),
|
||||
Expand = true,
|
||||
@ -141,7 +141,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 10);
|
||||
|
||||
// When
|
||||
console.Render(new Panel("Hello World")
|
||||
console.Write(new Panel("Hello World")
|
||||
{
|
||||
Header = new PanelHeader("Greeting"),
|
||||
Expand = true,
|
||||
@ -159,7 +159,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel(new Text(" \n💩\n ")));
|
||||
console.Write(new Panel(new Text(" \n💩\n ")));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -173,7 +173,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel(new Text("Hello World\nFoo Bar")));
|
||||
console.Write(new Panel(new Text("Hello World\nFoo Bar")));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -189,7 +189,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
new Markup("I heard [underline on blue]you[/] like 📦\n\n\n\nSo I put a 📦 in a 📦"));
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -203,7 +203,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel(new Text("Hello World"))
|
||||
console.Write(new Panel(new Text("Hello World"))
|
||||
{
|
||||
Expand = true,
|
||||
});
|
||||
@ -220,7 +220,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 25);
|
||||
|
||||
// When
|
||||
console.Render(
|
||||
console.Write(
|
||||
new Panel(new Text("Hello World").RightAligned())
|
||||
{
|
||||
Expand = true,
|
||||
@ -238,7 +238,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 25);
|
||||
|
||||
// When
|
||||
console.Render(
|
||||
console.Write(
|
||||
new Panel(new Text("Hello World").Centered())
|
||||
{
|
||||
Expand = true,
|
||||
@ -256,7 +256,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Panel(new Panel(new Text("Hello World"))));
|
||||
console.Write(new Panel(new Panel(new Text("Hello World"))));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -281,7 +281,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.Header("[grey]Short paths[/]");
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -300,7 +300,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = new Panel(table);
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
console.Write(panel);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System;
|
||||
using Spectre.Console.Rendering;
|
||||
using Spectre.Console.Testing;
|
||||
|
||||
@ -21,8 +20,8 @@ namespace Spectre.Console.Tests.Unit
|
||||
public string Render()
|
||||
{
|
||||
var console = new FakeConsole();
|
||||
var context = new RenderContext(Encoding.UTF8, false);
|
||||
console.Render(Column.Render(context, Task, TimeSpan.Zero));
|
||||
var context = new RenderContext(console.Profile.Capabilities);
|
||||
console.Write(Column.Render(context, Task, TimeSpan.Zero));
|
||||
return console.Output;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole();
|
||||
var recorder = new Recorder(console);
|
||||
|
||||
recorder.Render(new Table()
|
||||
recorder.Write(new Table()
|
||||
.AddColumns("Foo", "Bar", "Qux")
|
||||
.AddRow("Corgi", "Waldo", "Zap")
|
||||
.AddRow(new Panel("Hello World").RoundedBorder()));
|
||||
@ -32,13 +32,13 @@ namespace Spectre.Console.Tests.Unit
|
||||
|
||||
[Fact]
|
||||
[Expectation("Html")]
|
||||
public Task Should_Export_Html_As_Expected()
|
||||
public Task Should_Export_Html_Text_As_Expected()
|
||||
{
|
||||
// Given
|
||||
var console = new FakeConsole();
|
||||
var recorder = new Recorder(console);
|
||||
|
||||
recorder.Render(new Table()
|
||||
recorder.Write(new Table()
|
||||
.AddColumns("[red on black]Foo[/]", "[green bold]Bar[/]", "[blue italic]Qux[/]")
|
||||
.AddRow("[invert underline]Corgi[/]", "[bold strikethrough]Waldo[/]", "[dim]Zap[/]")
|
||||
.AddRow(new Panel("[blue]Hello World[/]")
|
||||
|
@ -25,7 +25,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
console.Pipeline.Attach(new HelloRenderHook());
|
||||
|
||||
// When
|
||||
console.Render(new Text("World"));
|
||||
console.Write(new Text("World"));
|
||||
|
||||
// Then
|
||||
console.Lines[0].ShouldBe("Hello");
|
||||
|
@ -28,7 +28,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
});
|
||||
|
||||
// When
|
||||
console.Render(rows);
|
||||
console.Write(rows);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -51,7 +51,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
}), new Text("Qux"));
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -74,7 +74,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
}).Expand(), new Text("Qux"));
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -19,7 +19,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule());
|
||||
console.Write(new Rule());
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -33,7 +33,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule().DoubleBorder());
|
||||
console.Write(new Rule().DoubleBorder());
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -47,7 +47,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule("Hello World").DoubleBorder());
|
||||
console.Write(new Rule("Hello World").DoubleBorder());
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -61,7 +61,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule("Hello World"));
|
||||
console.Write(new Rule("Hello World"));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -75,7 +75,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule("Hello World")
|
||||
console.Write(new Rule("Hello World")
|
||||
{
|
||||
Alignment = Justify.Left,
|
||||
});
|
||||
@ -92,7 +92,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule("Hello World")
|
||||
console.Write(new Rule("Hello World")
|
||||
{
|
||||
Alignment = Justify.Right,
|
||||
});
|
||||
@ -109,7 +109,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule("Hello\nWorld\r\n!"));
|
||||
console.Write(new Rule("Hello\nWorld\r\n!"));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -123,7 +123,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule(" Hello World "));
|
||||
console.Write(new Rule(" Hello World "));
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -149,7 +149,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width);
|
||||
|
||||
// When
|
||||
console.Render(new Rule(input));
|
||||
console.Write(new Rule(input));
|
||||
|
||||
// Then
|
||||
console.Lines.Count.ShouldBe(1);
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Shouldly;
|
||||
using Spectre.Console.Rendering;
|
||||
@ -39,11 +38,10 @@ namespace Spectre.Console.Tests.Unit
|
||||
{
|
||||
// Given
|
||||
var style = new Style(Color.Red, Color.Green, Decoration.Bold);
|
||||
var context = new RenderContext(Encoding.UTF8, false);
|
||||
var segment = new Segment(text, style);
|
||||
|
||||
// When
|
||||
var (first, second) = segment.Split(context, offset);
|
||||
var (first, second) = segment.Split(offset);
|
||||
|
||||
// Then
|
||||
first.Text.ShouldBe(expectedFirst);
|
||||
@ -60,10 +58,8 @@ namespace Spectre.Console.Tests.Unit
|
||||
[Expectation("Segment", "Split")]
|
||||
public Task Should_Split_Segment()
|
||||
{
|
||||
var context = new RenderContext(Encoding.UTF8, false);
|
||||
|
||||
// Given, When
|
||||
var lines = Segment.SplitLines(
|
||||
context,
|
||||
new[]
|
||||
{
|
||||
new Segment("Foo"),
|
||||
@ -95,9 +91,8 @@ namespace Spectre.Console.Tests.Unit
|
||||
[Expectation("Segment", "Split_Linebreak")]
|
||||
public Task Should_Split_Segments_With_Linebreak_In_Text()
|
||||
{
|
||||
var context = new RenderContext(Encoding.UTF8, false);
|
||||
// Given, Given
|
||||
var lines = Segment.SplitLines(
|
||||
context,
|
||||
new[]
|
||||
{
|
||||
new Segment("Foo\n"),
|
||||
|
@ -47,7 +47,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().NoBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -89,7 +89,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().AsciiBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -131,7 +131,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().Ascii2Border();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -173,7 +173,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().AsciiDoubleHeadBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -215,7 +215,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().SquareBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -257,7 +257,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().RoundedBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -299,7 +299,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().MinimalBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -341,7 +341,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().MinimalHeavyHeadBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -383,7 +383,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().MinimalDoubleHeadBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -425,7 +425,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().SimpleBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -467,7 +467,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().HorizontalBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -509,7 +509,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().SimpleHeavyBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -551,7 +551,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().HeavyBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -593,7 +593,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().HeavyEdgeBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -635,7 +635,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().HeavyHeadBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -677,7 +677,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().DoubleBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -719,7 +719,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().DoubleEdgeBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -761,7 +761,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable().MarkdownBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -776,7 +776,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable(header2: Justify.Left).MarkdownBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -791,7 +791,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable(header2: Justify.Center).MarkdownBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -806,7 +806,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var table = Fixture.GetTable(header2: Justify.Right).MarkdownBorder();
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -139,7 +139,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -158,7 +158,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -178,7 +178,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -197,7 +197,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -216,7 +216,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -235,7 +235,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -255,7 +255,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// Render a table in some panels.
|
||||
console.Render(new Panel(new Panel(table)
|
||||
console.Write(new Panel(new Panel(table)
|
||||
{
|
||||
Border = BoxBorder.Ascii,
|
||||
}));
|
||||
@ -278,7 +278,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Lorem ipsum dolor sit amet");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -296,7 +296,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -314,7 +314,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -333,7 +333,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -350,7 +350,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddColumn(new TableColumn("Baz") { Padding = new Padding(3, 0, 2, 0) });
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -388,7 +388,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow(new Markup("[blue]Hej[/]"), new Markup("[yellow]Världen[/]"), Text.Empty);
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -408,7 +408,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -429,7 +429,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -450,7 +450,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -471,7 +471,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
table.AddRow("Grault", "Garply", "Fred");
|
||||
|
||||
// When
|
||||
console.Render(table);
|
||||
console.Write(table);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System.Text;
|
||||
using Shouldly;
|
||||
using Spectre.Console.Rendering;
|
||||
using Spectre.Console.Testing;
|
||||
@ -12,10 +11,11 @@ namespace Spectre.Console.Tests.Unit
|
||||
public void Should_Consider_The_Longest_Word_As_Minimum_Width()
|
||||
{
|
||||
// Given
|
||||
var caps = new FakeCapabilities { Unicode = true };
|
||||
var text = new Text("Foo Bar Baz\nQux\nLol mobile");
|
||||
|
||||
// When
|
||||
var result = ((IRenderable)text).Measure(new RenderContext(Encoding.Unicode, false), 80);
|
||||
var result = ((IRenderable)text).Measure(new RenderContext(caps), 80);
|
||||
|
||||
// Then
|
||||
result.Min.ShouldBe(6);
|
||||
@ -25,10 +25,11 @@ namespace Spectre.Console.Tests.Unit
|
||||
public void Should_Consider_The_Longest_Line_As_Maximum_Width()
|
||||
{
|
||||
// Given
|
||||
var caps = new FakeCapabilities { Unicode = true };
|
||||
var text = new Text("Foo Bar Baz\nQux\nLol mobile");
|
||||
|
||||
// When
|
||||
var result = ((IRenderable)text).Measure(new RenderContext(Encoding.Unicode, false), 80);
|
||||
var result = ((IRenderable)text).Measure(new RenderContext(caps), 80);
|
||||
|
||||
// Then
|
||||
result.Max.ShouldBe(11);
|
||||
@ -42,7 +43,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var text = new Text("Hello World");
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
console.Output.ShouldBe("Hello World");
|
||||
@ -58,7 +59,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var text = new Text(input);
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
console.Output.ShouldBe("Hello\n\nWorld\n\n");
|
||||
@ -71,7 +72,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var console = new FakeConsole(width: 80);
|
||||
|
||||
// When
|
||||
console.Render(new Markup("[b]Hello World[/]\n[yellow]Hello World[/]"));
|
||||
console.Write(new Markup("[b]Hello World[/]\n[yellow]Hello World[/]"));
|
||||
|
||||
// Then
|
||||
console.Lines.Count.ShouldBe(2);
|
||||
@ -90,7 +91,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var text = new Text(input);
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
console.Output
|
||||
@ -110,7 +111,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
.Overflow(overflow);
|
||||
|
||||
// When
|
||||
console.Render(text);
|
||||
console.Write(text);
|
||||
|
||||
// Then
|
||||
console.Output
|
||||
|
@ -37,7 +37,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
tree.AddNode("child4");
|
||||
|
||||
// When
|
||||
console.Render(tree);
|
||||
console.Write(tree);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -52,7 +52,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
var tree = new Tree(new Text("Root node"));
|
||||
|
||||
// When
|
||||
console.Render(tree);
|
||||
console.Write(tree);
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(console.Output);
|
||||
@ -76,7 +76,7 @@ namespace Spectre.Console.Tests.Unit
|
||||
tree.AddNodes(root);
|
||||
|
||||
// When
|
||||
var result = Record.Exception(() => console.Render(tree));
|
||||
var result = Record.Exception(() => console.Write(tree));
|
||||
|
||||
// Then
|
||||
result.ShouldBeOfType<CircularTreeException>();
|
||||
|
Reference in New Issue
Block a user