ColorSchemeTests.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Linq;
  3. using Xunit;
  4. namespace Terminal.Gui.DrawingTests;
  5. public class ColorSchemeTests {
  6. [Fact]
  7. public void Colors_ColorSchemes_Property_Has_Private_Setter ()
  8. {
  9. // Resharper Code Cleanup likes to remove the `private set; `
  10. // from the ColorSchemes property. This test will fail if
  11. // that happens.
  12. var property = typeof (Colors).GetProperty ("ColorSchemes");
  13. Assert.NotNull (property);
  14. Assert.NotNull (property.SetMethod);
  15. Assert.True (property.GetSetMethod (true).IsPrivate);
  16. }
  17. [Fact]
  18. public void ColorScheme_New ()
  19. {
  20. var scheme = new ColorScheme ();
  21. var lbl = new Label ();
  22. lbl.ColorScheme = scheme;
  23. lbl.Draw ();
  24. }
  25. [Fact]
  26. public void Colors_ColorSchemes_Built_Ins ()
  27. {
  28. Colors.Reset ();
  29. var schemes = Colors.ColorSchemes;
  30. Assert.NotNull (schemes);
  31. Assert.Equal (5, schemes.Count);
  32. Assert.True (schemes.ContainsKey ("TopLevel"));
  33. Assert.True (schemes.ContainsKey ("Base"));
  34. Assert.True (schemes.ContainsKey ("Dialog"));
  35. Assert.True (schemes.ContainsKey ("Menu"));
  36. Assert.True (schemes.ContainsKey ("Error"));
  37. }
  38. }