Add fallback for unicode borders

This commit is contained in:
Patrik Svensson
2020-08-07 22:24:38 +02:00
parent d475e3b30a
commit fa85216554
14 changed files with 149 additions and 58 deletions

View File

@ -10,13 +10,18 @@ namespace Spectre.Console.Tests.Unit.Composition
public sealed class TheGetBorderMethod
{
[Theory]
[InlineData(BorderKind.Ascii, typeof(AsciiBorder))]
[InlineData(BorderKind.Square, typeof(SquareBorder))]
[InlineData(BorderKind.Rounded, typeof(RoundedBorder))]
public void Should_Return_Correct_Border_For_Specified_Kind(BorderKind kind, Type expected)
[InlineData(BorderKind.None, false, typeof(NoBorder))]
[InlineData(BorderKind.Ascii, false, typeof(AsciiBorder))]
[InlineData(BorderKind.Square, false, typeof(SquareBorder))]
[InlineData(BorderKind.Rounded, false, typeof(RoundedBorder))]
[InlineData(BorderKind.None, true, typeof(NoBorder))]
[InlineData(BorderKind.Ascii, true, typeof(AsciiBorder))]
[InlineData(BorderKind.Square, true, typeof(SquareBorder))]
[InlineData(BorderKind.Rounded, true, typeof(SquareBorder))]
public void Should_Return_Correct_Border_For_Specified_Kind(BorderKind kind, bool safe, Type expected)
{
// Given, When
var result = Border.GetBorder(kind);
var result = Border.GetBorder(kind, safe);
// Then
result.ShouldBeOfType(expected);
@ -26,7 +31,7 @@ namespace Spectre.Console.Tests.Unit.Composition
public void Should_Throw_If_Unknown_Border_Kind_Is_Specified()
{
// Given, When
var result = Record.Exception(() => Border.GetBorder((BorderKind)int.MaxValue));
var result = Record.Exception(() => Border.GetBorder((BorderKind)int.MaxValue, false));
// Then
result.ShouldBeOfType<InvalidOperationException>();