AutocompleteTests.cs 625 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Terminal.Gui;
  7. using Xunit;
  8. namespace UnitTests {
  9. public class AutocompleteTests {
  10. [Fact][AutoInitShutdown]
  11. public void Test_GenerateSuggestions_Simple()
  12. {
  13. var ac = new Autocomplete ();
  14. ac.AllSuggestions = new List<string> { "fish","const","Cobble"};
  15. var tv = new TextView ();
  16. tv.InsertText ("co");
  17. ac.GenerateSuggestions (tv);
  18. Assert.Equal (2, ac.Suggestions.Count);
  19. Assert.Equal ("const", ac.Suggestions[0]);
  20. Assert.Equal ("Cobble", ac.Suggestions[1]);
  21. }
  22. }
  23. }