public void CmdHelp_TrueWithNoArguments() { CmdHelp _help = new CmdHelp(); string[] args = {}; var result = _help.Validate(args); Assert.True(result, "Help should return true with no arguments"); }
public void CmdHelp_FalseWithMore1Args() { CmdHelp _help = new CmdHelp(); string[] args = { "string1", "string2" }; var result = _help.Validate(args); Assert.False(result, "Help should return false with more than one arguments"); }
public void AddCommands(CommandInfo Commands) { if (Commands.Commands.Count != NumCmds) { throw new ArgumentOutOfRangeException("Commands.Commands", "Must be exactly " + NumCmds.ToString() + " commands to match number of buttons in UI"); } // form command map foreach (CommandItemInfo cii in Commands.Commands) { switch (cii.CommandId) { case CommandId.WarpEngineControl: mCommands.Add(CmdWarpEngineCtrl.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.ShortRangeScan: mCommands.Add(CmdShortRangeScan.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.LongRangeScan: mCommands.Add(CmdLongRangeScan.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.PhaserControl: mCommands.Add(CmdPhaserCtrl.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.PhotonTorpedoControl: mCommands.Add(CmdPhotonTorpCtrl.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.AddEnergyToShields: mCommands.Add(CmdShieldsEnergyAdd.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.SubtractEnergyFromShields: mCommands.Add(CmdShieldsEnergySubtract.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.DamageControl: mCommands.Add(CmdRepairDamage.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.CumulativeGalaticRecord: mCommands.Add(CmdGalacticRecord.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.StatusReport: mCommands.Add(CmdStatusReport.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.PhotonTorpedoCalculator: mCommands.Add(CmdPhotonTorpCalc.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.StarbaseCalculator: mCommands.Add(CmdStarBaseCalc.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.NavigationCalculator: mCommands.Add(CmdNavCalc.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.SaveGame: mCommands.Add(CmdSaveGame.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.LoadGame: mCommands.Add(CmdLoadGame.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.Help: mCommands.Add(CmdHelp.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.About: mCommands.Add(CmdAbout.Title(UIControlState.Normal), cii.CommandId); break; case CommandId.ResignCommission: mCommands.Add(CmdResign.Title(UIControlState.Normal), cii.CommandId); break; default: throw new ArgumentOutOfRangeException("Failed to handle: " + cii.CommandId); } Debug.Assert(mCommands.Count == NumCmds); } }