public static int Execute(string[] args, IConfiguration config) => Parser.Default.ParseArguments <RunOptions, AssembleOptions, DisassembleOptions, FormatOptions>(args).MapResult( (RunOptions opts) => RunCommand.Run(opts, _fileReader, _outputWriter, config), (AssembleOptions opts) => AssembleCommand.Run(opts, _fileReader, _fileWriter, config), (DisassembleOptions opts) => DisassembleCommand.Run(opts, _fileReader, _fileWriter, config), (FormatOptions opts) => FormatCommand.Run(opts, _fileReader, _fileWriter, config), errs => 1);
public void Asm_command_tests(string name) { // Arrange var content = _testSource.VrilFiles[name]; var expected = _testSource.BinFiles[name]; var options = new AssembleOptions() { FilePath = name }; var reader = MockFactory.NewFileReader(content); var writer = MockFactory.NewFileWriter(); var configuration = MockFactory.NewConfiguration(); // Act AssembleCommand.Run(options, reader, writer, configuration); // Assert var file = Assert.Single(writer.Files.Values); var actual = Assert.IsType <byte[]>(file); Assert.True(Enumerable.SequenceEqual(expected, actual)); }