Commits

Christian Specht committed cc2f715 Draft

expose names of loaded command sets from CommandCenter

Comments (0)

Files changed (3)

src/MissileSharp.Tests/CommandSetListTests.cs

         }
 
         [Test]
+        public void GetCommandSetNames_ListWithOneItem_ReturnsOne()
+        {
+            list.Add("name", Command.Up, 1);
+            Assert.AreEqual(1, list.GetCommandSetNames().Count);
+        }
+
+        [Test]
+        public void GetCommandSetNames_ListWithOneItem_ReturnsCorrectName()
+        {
+            list.Add("name", Command.Up, 1);
+            Assert.AreEqual("name", list.GetCommandSetNames()[0]);
+        }
+
+        [Test]
         public void ContainsCommandSet_ExistingCommandSet_ReturnsTrue()
         {
             list.Add("name", Command.Up, 1);

src/MissileSharp/CommandCenter.cs

         }
 
         /// <summary>
+        /// Gets a list with the names of all loaded command sets.
+        /// </summary>
+        /// <returns>A list of command set names</returns>
+        public List<string> GetLoadedCommandSetNames()
+        {
+            if (sets.CountSets() > 0)
+            {
+                return sets.GetCommandSetNames();
+            }
+
+            return new List<string>();
+        }
+
+        /// <summary>
         /// Move up for X milliseconds
         /// </summary>
         /// <param name="milliseconds">Time to move</param>

src/MissileSharp/CommandSetList.cs

         }
 
         /// <summary>
+        /// Gets the names of all available command sets
+        /// </summary>
+        /// <returns>A list of command set names</returns>
+        public List<string> GetCommandSetNames()
+        {
+            return new List<string>(dict.Keys);
+        }
+
+        /// <summary>
         /// Counts the number of command sets.
         /// </summary>
         public int CountSets()