public void Execute_WrongCommand() { // arrange #1 _params.CommandType = (CommandType)5; // act var exception = Assert.Throws <InvalidOperationException>(() => _sut.Execute(_params, CancellationToken.None)); // assert Assert.That(exception, Is.Not.Null); Assert.That(exception.Message, Is.EqualTo("Unknown command type")); }
public static int Main(string[] args) { if (!CompressionParams.TryParse(args, out var @params)) { Console.WriteLine("Error! Usage: ArchiveTest.exe <compress/decompress> <source path> <destination path>"); return(1); } Console.CancelKeyPress += Handler; try { _gZipService.Execute(@params, _cancellationTokenSource.Token); return(0); } catch (Exception e) { Console.WriteLine(e.Message); return(1); } }