Add support for alignment

This commit is contained in:
Patrik Svensson
2022-02-21 18:35:21 +01:00
committed by Phil Scott
parent 5e41a2f505
commit eb4a7d3bf4
8 changed files with 88 additions and 32 deletions

View File

@ -14,7 +14,8 @@ public sealed class TextPathTests
console.Write(new TextPath(input));
// Then
console.Output.TrimEnd().ShouldBe(expected);
console.Output.TrimEnd()
.ShouldBe(expected);
}
[Theory]
@ -30,7 +31,8 @@ public sealed class TextPathTests
console.Write(new TextPath(input));
// Then
console.Output.TrimEnd().ShouldBe(expected);
console.Output.TrimEnd()
.ShouldBe(expected);
}
[Theory]
@ -46,7 +48,8 @@ public sealed class TextPathTests
console.Write(new TextPath(input));
// Then
console.Output.TrimEnd().ShouldBe(expected);
console.Output.TrimEnd()
.ShouldBe(expected);
}
[Theory]
@ -66,4 +69,32 @@ public sealed class TextPathTests
// Then
console.Output.ShouldEndWith("\n");
}
[Fact]
public void Should_Right_Align_Correctly()
{
// Given
var console = new TestConsole().Width(40);
// When
console.Write(new TextPath("C:/My documents/Bar/Baz.txt").RightAligned());
// Then
console.Output.TrimEnd('\n')
.ShouldBe(" C:/My documents/Bar/Baz.txt");
}
[Fact]
public void Should_Center_Align_Correctly()
{
// Given
var console = new TestConsole().Width(40);
// When
console.Write(new TextPath("C:/My documents/Bar/Baz.txt").Centered());
// Then
console.Output.TrimEnd('\n')
.ShouldBe(" C:/My documents/Bar/Baz.txt ");
}
}