ColorSchemeTests.cs 1.2 KB

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