Example #1
0
 public void MissingRegex()
 {
   var cmd = new Cmd.Grep();
   base.InitCommand(cmd);
   cmd.Input = "Lorem ipsum";
   CommandResult result = cmd.Run();
   Assert.AreEqual(CommandStatus.Failure, result.Status);
 }
Example #2
0
 public void InStringsRegexNumber()
 {
   var cmd = new Cmd.Grep();
   base.InitCommand(cmd);
   cmd.Regex = "\\d";
   cmd.Input = "Line 1\r\nLine Two\r\nLine Three";
   CommandResult result = cmd.Run();
   Assert.AreEqual(CommandStatus.Success, result.Status);
   Assert.AreEqual("Line 1", result.Message.Trim());
 }
Example #3
0
 public void NoMatches()
 {
   var cmd = new Cmd.Grep();
   base.InitCommand(cmd);
   cmd.Regex = "-";
   cmd.Input = "Line 1\r\nLine Two\r\nLine Three";
   CommandResult result = cmd.Run();
   Assert.AreEqual(CommandStatus.Success, result.Status);
   Assert.AreEqual(string.Empty, result.Message.Trim());
 }
Example #4
0
 public void InStrings()
 {
   var cmd = new Cmd.Grep();
   base.InitCommand(cmd);
   cmd.Regex = "\\bc.+";
   cmd.Input = "Contains matched line\r\nNo match\r\nNo match\r\nContains";
   CommandResult result = cmd.Run();
   Assert.AreEqual(CommandStatus.Success, result.Status);
   Assert.AreEqual("Contains matched line\r\nContains", result.Message.Trim());
 }