static int Main(string[] args) { var cmdParam = new CmdParam(args); if (cmdParam.ContainsUasgeParam()) { Console.WriteLine(CmdMessage.GetUsage()); } else if (cmdParam.IsError()) { Console.WriteLine(CmdMessage.GetUsageErrorPrompt()); return(Error); } else { ShowCurrentDirectory(); var cmdEntry = new CmdEntry(cmdParam); foreach (var line in cmdEntry.GetExecuteResult()) { Console.WriteLine(line); } } return(Success); }
public void should_return_true_when_args_is_error() { var cmdParam1 = new CmdParam(new[] { "f", }); var cmdParam2 = new CmdParam(new[] { "/" }); Assert.AreEqual(true, cmdParam1.IsError()); Assert.AreEqual(true, cmdParam2.IsError()); }
public void should_return_false_when_args_is_not_error() { var cmdParam1 = new CmdParam(new[] { "/f" }); var cmdParam2 = new CmdParam(new[] { "/d" }); var cmdParam3 = new CmdParam(new[] { "/w" }); var cmdParam4 = new CmdParam(new[] { "/?" }); var cmdParam5 = new CmdParam(new string[] { }); Assert.AreEqual(false, cmdParam1.IsError()); Assert.AreEqual(false, cmdParam2.IsError()); Assert.AreEqual(false, cmdParam3.IsError()); Assert.AreEqual(false, cmdParam4.IsError()); Assert.AreEqual(false, cmdParam5.IsError()); }