mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-02 19:08:15 +08:00

committed by
Phil Scott

parent
ca036f6543
commit
13ac38ed04
@ -1,3 +1,4 @@
|
||||
using System.IO;
|
||||
using Shouldly;
|
||||
using Spectre.Console.Testing;
|
||||
using Xunit;
|
||||
@ -6,6 +7,25 @@ namespace Spectre.Console.Tests.Unit
|
||||
{
|
||||
public partial class AnsiConsoleTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(ColorSystemSupport.NoColors, ColorSystem.NoColors)]
|
||||
[InlineData(ColorSystemSupport.Legacy, ColorSystem.Legacy)]
|
||||
[InlineData(ColorSystemSupport.Standard, ColorSystem.Standard)]
|
||||
[InlineData(ColorSystemSupport.EightBit, ColorSystem.EightBit)]
|
||||
[InlineData(ColorSystemSupport.TrueColor, ColorSystem.TrueColor)]
|
||||
public void Should_Create_Console_With_Requested_ColorSystem(ColorSystemSupport requested, ColorSystem expected)
|
||||
{
|
||||
// Given, When
|
||||
var console = AnsiConsole.Create(new AnsiConsoleSettings
|
||||
{
|
||||
ColorSystem = requested,
|
||||
Out = new StringWriter(),
|
||||
});
|
||||
|
||||
// Then
|
||||
console.Profile.ColorSystem.ShouldBe(expected);
|
||||
}
|
||||
|
||||
public sealed class TrueColor
|
||||
{
|
||||
[Theory]
|
||||
|
23
src/Spectre.Console.Tests/Unit/ColorSystemTests.cs
Normal file
23
src/Spectre.Console.Tests/Unit/ColorSystemTests.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
|
||||
namespace Spectre.Console.Tests.Unit
|
||||
{
|
||||
public sealed class ColorSystemTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(ColorSystem.NoColors, ColorSystemSupport.NoColors)]
|
||||
[InlineData(ColorSystem.Legacy, ColorSystemSupport.Legacy)]
|
||||
[InlineData(ColorSystem.Standard, ColorSystemSupport.Standard)]
|
||||
[InlineData(ColorSystem.EightBit, ColorSystemSupport.EightBit)]
|
||||
[InlineData(ColorSystem.TrueColor, ColorSystemSupport.TrueColor)]
|
||||
public void Should_Be_Analog_To_ColorSystemSupport(ColorSystem colors, ColorSystemSupport support)
|
||||
{
|
||||
// Given, When
|
||||
var result = (int)colors;
|
||||
|
||||
// Then
|
||||
result.ShouldBe((int)support);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user