What is the best way to use AnsiConsole in Unit Tests? #831
-
Hi I want to have a clear (empty) AnsiConsole in each test. I have tried to do AnsiConsole.Clear() but that throws an exception. Have I missed something? :) |
Beta Was this translation helpful? Give feedback.
Answered by
patriksvensson
May 16, 2022
Replies: 1 comment 1 reply
-
@buzzfrog Take a look at Example of usage: |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
buzzfrog
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@buzzfrog Take a look at
TestConsole
(which implementsIAnsiConsole
) in theSpectre.Console.Testing
NuGet package. This is what Spectre.Console uses for it's own tests as well.Example of usage:
spectre.console/test/Spectre.Console.Tests/Unit/AnsiConsoleTests.cs
Line 10 in 5b2b437