public void DuplicateAlias() { int errorCount = 0; using (var ms = new MemoryStream()) { var fakeShell = new Shell { Error = (msg) => { Assert.IsTrue(!string.IsNullOrWhiteSpace(msg)); errorCount++; } }; fakeShell.AddCSAlias("echo", "Console.WriteLine(\"{0}\");"); fakeShell.AddCSAlias("echo", "sdfsdfsdf"); fakeShell.AddCmdAlias("l", "ls -CF "); fakeShell.AddCmdAlias("l", "ls -CF "); } Assert.AreEqual(2, errorCount); }
public void AddAliases() { using (var ms = new MemoryStream()) { var fakeShell = new Shell(); fakeShell.AddCSAlias("echo", "Console.WriteLine(\"{0}\");"); fakeShell.AddCSAlias("red", "Console.WriteLine(new ColorString(\"{0}\", Color.Red).TextWithFormattingCharacters);"); fakeShell.AddCSAlias("green", "Console.WriteLine(new ColorString(\"{0}\", Color.Green).TextWithFormattingCharacters);"); fakeShell.AddCSAlias("quit", "Environment.Exit(0);"); fakeShell.AddCmdAlias("ls", "ls --color=auto "); fakeShell.AddCmdAlias("dir", "dir --color=always "); fakeShell.AddCmdAlias("vdir", "vdir --color=always "); fakeShell.AddCmdAlias("grep", "grep --color=always "); fakeShell.AddCmdAlias("fgrep", "fgrep --color=alway s"); fakeShell.AddCmdAlias("egrep", "egrep --color=always "); fakeShell.AddCmdAlias("ll", "ls -alF "); fakeShell.AddCmdAlias("la", "ls -A "); fakeShell.AddCmdAlias("l", "ls -CF "); } }