Example #1
0
    public void EmptyRegex()
    {
      var cmd = new Cmd.RegexMatch();
      InitCommand(cmd);

      cmd.Input = "I sat by the ocean";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
Example #2
0
    public void EmptyInput()
    {
      var cmd = new Cmd.RegexMatch();
      InitCommand(cmd);

      cmd.Regex = ".*";

      var result = cmd.Run();
      
      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
    }
Example #3
0
    public void NoMatch()
    {
      var cmd = new Cmd.RegexMatch();
      InitCommand(cmd);

      cmd.Input = "I sat by the ocean";
      cmd.Regex = "moon";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Is.Empty);
    }
Example #4
0
    public void Match_CaseSensitive()
    {
      var cmd = new Cmd.RegexMatch();
      InitCommand(cmd);

      cmd.Input = "I sat by the ocean";
      cmd.Regex = "\\socean";
      cmd.CaseSensitive = true;

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Is.EqualTo(" ocean"));
    }