DiagnosticsTests.cs 997 B

1234567891011121314151617181920212223242526272829
  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 (ITestOutputHelper output)
  10. {
  11. /// <summary>
  12. /// /// Tests <see cref="View.Diagnostics"/> static property and <see cref="ViewDiagnosticFlags"/> enum.
  13. /// /// </summary>
  14. [Fact]
  15. public void Diagnostics_Sets ()
  16. {
  17. // View.Diagnostics is a static property that returns the current diagnostic flags.
  18. Assert.Equal (ViewDiagnosticFlags.Off, View.Diagnostics);
  19. // View.Diagnostics can be set to a new value.
  20. View.Diagnostics = ViewDiagnosticFlags.Padding;
  21. Assert.Equal (ViewDiagnosticFlags.Padding, View.Diagnostics);
  22. // Ensure we turn off at the end of the test
  23. View.Diagnostics = ViewDiagnosticFlags.Off;
  24. }
  25. }