public void PwdTest() { var previousDirectory = Directory.GetCurrentDirectory(); new CdCommand().Execute("../../../TestFiles"); var expected = Directory.GetCurrentDirectory() + "\n" + Directory.GetCurrentDirectory() + "\\file.txt"; var actual = new PwdCommand().Execute("file.txt"); new CdCommand().Execute(previousDirectory); Assert.AreEqual(expected, actual); }
public CommandApplier() { simulator = new BashSimulator(); commands = new Dictionary <string, ICommand>(); CatCommand catCommand = new CatCommand(); commands[catCommand.Name] = catCommand; WcCommand wcCommand = new WcCommand(); commands[wcCommand.Name] = wcCommand; PwdCommand pwdCommand = new PwdCommand(); commands[pwdCommand.Name] = pwdCommand; AnotherCommand anotherCommand = new AnotherCommand(); commands[anotherCommand.Name] = anotherCommand; EchoCommand echoCommand = new EchoCommand(); commands[echoCommand.Name] = echoCommand; }