ComboBoxTests.cs 650 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Linq;
  3. using Terminal.Gui;
  4. using Xunit;
  5. namespace Terminal.Gui.Views {
  6. public class ComboBoxTests {
  7. [Fact]
  8. [AutoInitShutdown]
  9. public void EnsureKeyEventsDoNotCauseExceptions ()
  10. {
  11. var comboBox = new ComboBox ("0");
  12. var source = Enumerable.Range (0, 15).Select (x => x.ToString ()).ToArray ();
  13. comboBox.SetSource(source);
  14. Application.Top.Add(comboBox);
  15. foreach (var key in (Key [])Enum.GetValues (typeof(Key))) {
  16. comboBox.ProcessKey (new KeyEvent (key, new KeyModifiers ()));
  17. }
  18. }
  19. }
  20. }