RulerTests.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. namespace Terminal.Gui.DrawingTests;
  2. /// <summary>
  3. /// Pure unit tests for <see cref="Ruler"/> that don't require Application.Driver or View context.
  4. /// These tests focus on properties and behavior that don't depend on rendering.
  5. ///
  6. /// Note: Tests that verify rendered output (Draw methods) require Application.Driver and remain in UnitTests as integration tests.
  7. /// </summary>
  8. public class RulerTests : UnitTests.Parallelizable.ParallelizableBase
  9. {
  10. [Fact]
  11. public void Constructor_Defaults ()
  12. {
  13. var r = new Ruler ();
  14. Assert.Equal (0, r.Length);
  15. Assert.Equal (Orientation.Horizontal, r.Orientation);
  16. }
  17. [Fact]
  18. public void Attribute_Set ()
  19. {
  20. var newAttribute = new Attribute (Color.Red, Color.Green);
  21. var r = new Ruler ();
  22. r.Attribute = newAttribute;
  23. Assert.Equal (newAttribute, r.Attribute);
  24. }
  25. [Fact]
  26. public void Length_Set ()
  27. {
  28. var r = new Ruler ();
  29. Assert.Equal (0, r.Length);
  30. r.Length = 42;
  31. Assert.Equal (42, r.Length);
  32. }
  33. [Fact]
  34. public void Orientation_Set ()
  35. {
  36. var r = new Ruler ();
  37. Assert.Equal (Orientation.Horizontal, r.Orientation);
  38. r.Orientation = Orientation.Vertical;
  39. Assert.Equal (Orientation.Vertical, r.Orientation);
  40. }
  41. }