Commits

Christian Specht  committed f9df4bb Draft

order loaded command set names alphabetically

  • Participants
  • Parent commits b7f736a

Comments (0)

Files changed (2)

File src/MissileSharp.Tests/Library/CommandSetListTests.cs

         }
 
         [Test]
+        public void GetCommandSetNames_UnsortedList_IsSortedAlphabetically()
+        {
+            list.Add("bb", Command.Up, 1);
+            list.Add("aa", Command.Up, 1);
+            list.Add("cc", Command.Up, 1);
+
+            Assert.AreEqual("aa", list.GetCommandSetNames()[0]);
+            Assert.AreEqual("bb", list.GetCommandSetNames()[1]);
+            Assert.AreEqual("cc", list.GetCommandSetNames()[2]);
+        }
+
+        [Test]
         public void ContainsCommandSet_ExistingCommandSet_ReturnsTrue()
         {
             list.Add("name", Command.Up, 1);

File src/MissileSharp/CommandSetList.cs

         /// <returns>A list of command set names</returns>
         public List<string> GetCommandSetNames()
         {
-            return new List<string>(dict.Keys);
+            return new List<string>(dict.Keys.OrderBy(d => d));
         }
 
         /// <summary>