DiagnosticsTests.cs 985 B

123456789101112131415161718192021222324252627282930
  1. #nullable enable
  2. using Xunit.Abstractions;
  3. namespace Terminal.Gui.ViewTests;
  4. /// <summary>
  5. /// Tests <see cref="View.Diagnostics"/> static property and <see cref="ViewDiagnosticFlags"/> enum.
  6. /// </summary>
  7. /// <param name="output"></param>
  8. [Trait ("Category", "Output")]
  9. public class DiagnosticTests ()
  10. {
  11. /// <summary>
  12. /// /// Tests <see cref="View.Diagnostics"/> static property and <see cref="ViewDiagnosticFlags"/> enum.
  13. /// ///
  14. /// </summary>
  15. [Fact]
  16. public void Diagnostics_Sets ()
  17. {
  18. // View.Diagnostics is a static property that returns the current diagnostic flags.
  19. Assert.Equal (ViewDiagnosticFlags.Off, View.Diagnostics);
  20. // View.Diagnostics can be set to a new value.
  21. View.Diagnostics = ViewDiagnosticFlags.Padding;
  22. Assert.Equal (ViewDiagnosticFlags.Padding, View.Diagnostics);
  23. // Ensure we turn off at the end of the test
  24. View.Diagnostics = ViewDiagnosticFlags.Off;
  25. }
  26. }