public void GivenOutputFile__OpenFile_CloseFile_LogError__StreamIsOpened_StreamIsClosed_NoErrorIsThrown() { RepackLogger logger = new RepackLogger(); Assert.IsTrue(logger.Open("file.out")); logger.Close(); const string message = "Only written to the console. No erorr is thrown."; logger.Error(message); logger.Warn(message); logger.Verbose(message); logger.Info(message); }
static int Main(string[] args) { ICommandLine commandLine = new CommandLine(args); ILogger logger = new RepackLogger(); IFile file = new FileWrapper(); RepackOptions options = new RepackOptions(commandLine, logger, file); int returnCode = -1; try { if (options.ShouldShowUsage()) { Usage(); Exit(2); } options.Parse(); //TODO: Open the Logger before the parse if (logger.Open(options.LogFile)) { options.Log = true; logger.ShouldLogVerbose = options.LogVerbose; } ILRepack repack = new ILRepack(options, logger); repack.Repack(); returnCode = 0; } catch (RepackOptions.InvalidTargetKindException e) { Console.WriteLine(e.Message); Usage(); Exit(2); } catch (Exception e) { logger.Log(e); returnCode = 1; } finally { logger.Close(); if (options.PauseBeforeExit) { Console.WriteLine("Press Any Key To Continue"); Console.ReadKey(true); } } return(returnCode); }
static int Main(string[] args) { RepackLogger logger = new RepackLogger(); RepackOptions options = new RepackOptions(args); int returnCode = -1; try { if (options.ShouldShowUsage) { Usage(); Exit(2); } logger.ShouldLogVerbose = options.LogVerbose; //TODO: Open the Logger before the parse if (logger.Open(options.LogFile)) { options.Log = true; } ILRepack repack = new ILRepack(options, logger); repack.Repack(); returnCode = 0; } catch (RepackOptions.InvalidTargetKindException e) { Console.WriteLine(e.Message); Usage(); Exit(2); } catch (Exception e) { logger.Log(e); returnCode = 1; } finally { logger.Close(); if (options.PauseBeforeExit) { Console.WriteLine("Press Any Key To Continue"); Console.ReadKey(true); } } return returnCode; }
static int Main(string[] args) { RepackOptions options = new RepackOptions(args); var logger = new RepackLogger(options); int returnCode = -1; try { if (options.ShouldShowUsage) { Usage(); Exit(2); } ILRepack repack = new ILRepack(options, logger); repack.Repack(); repack.Dispose(); returnCode = 0; } catch (RepackOptions.InvalidTargetKindException e) { Console.WriteLine(e.Message); Usage(); Exit(2); } catch (Exception e) { logger.Log(e); returnCode = 1; } finally { logger.Dispose(); if (options.PauseBeforeExit) { Console.WriteLine("Press Any Key To Continue"); Console.ReadKey(true); } } return(returnCode); }
public void GivenAnEmptyOutputFile__OpenFile_LogLine__OpenReturnsFalse_LogDoesNotThrowError() { RepackLogger logger = new RepackLogger(); Assert.IsFalse(logger.Open("")); logger.Log("Hello"); }
public void GivenAnEmptyOutputFile__OpenFile_CloseFile__OpenReturnsFalse_ClosedDoesNotThrowError() { RepackLogger logger = new RepackLogger(); Assert.IsFalse(logger.Open("")); logger.Close(); }