private static void CheckRunCompareFolder(string[] p_Args, string p_ExpectedFolderPath, string p_ActualFolderPath, string p_Message = "") { int returnValue = CliApp.Run(p_Args); Assert.AreEqual(0, returnValue, p_Message + ": wrong return value"); AssertFoldersEqual(p_ExpectedFolderPath, p_ActualFolderPath, p_Message + ": folders differ"); }
private static void CheckRunFileExists(string[] p_Args, string p_UnexpectedOutput, string p_Message) { int returnValue = CliApp.Run(p_Args); Assert.AreEqual(0, returnValue, p_Message + ": wrong return value"); Assert.IsTrue(!File.Exists(p_UnexpectedOutput), p_Message + ": file exists but should not"); }
// Comapators private static void CheckRunCompareFile(string[] p_Args, string p_ExpectedFilePath, string p_ActualFilePath, string p_Message = "", int p_ReturnCode = 0) { int returnValue = CliApp.Run(p_Args); Assert.AreEqual(p_ReturnCode, returnValue, p_Message + ": wrong return value"); AssertFilesEqual(p_ExpectedFilePath, p_ActualFilePath, p_Message + ": files differ"); }
static void Main(string[] args) { Cli = new CliAppBuilder() .AddActionArg(FindPackage, "Find NuGet package using API", "find") .Build(); Cli.Start(args); }
} // ----------------------------------------- /// <summary> /// Sets and Checks a new FFMPEG PATH /// </summary> /// <param name="ffmpeg_path">Folder FFMPEG is in,</param> public static void setFFMPEGPath(string ffmpeg_path = "") { if (CliApp.exists(Path.Combine(ffmpeg_path, FFMPEG_EXE))) { FFMPEG_OK = true; FFMPEG_PATH = ffmpeg_path; } } // -----------------------------------------
// todo: remove this method? private static void CheckRunFail(string[] p_Args, int p_ExpectedReturnValue, string p_Message = "") { int returnValue = CliApp.Run(p_Args); Assert.AreEqual(p_ExpectedReturnValue, returnValue, p_Message + ": wrong return value"); // todo make check for console output? // todo check files not modified? }
private static void CheckRunCompareOutput(string[] p_Args, string p_ExpectedOutput, string p_Message = "") { StringWriter stringWriter = new(); Console.SetOut(stringWriter); int returnValue = CliApp.Run(p_Args); Assert.AreEqual(0, returnValue, p_Message + ": wrong return value"); string ActualOutput = stringWriter.ToString(); Assert.AreEqual("\r\n" + p_ExpectedOutput, "\r\n" + ActualOutput, p_Message + ": outputs are not equal"); }
public static int Main(string[] p_Args) { if (p_Args != null && p_Args.Length > 0) { return(CliApp.Run(p_Args)); } else { HideConsoleWindow(); GuiApp guiApp = new(); guiApp.InitializeComponent(); guiApp.Run(); return(0); } }
static void Main(string[] args) { CliApp.Run <Program>(); }