예제 #1
0
    public void MissingCommand()
    {
      var cmd = new Cmd.IndexSearch();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Query = FIELD1_NAME + ":" + _item1Field;

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
예제 #2
0
    public void MissingQuery()
    {
      var cmd = new Cmd.IndexSearch();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Command = "ga -a id";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
예제 #3
0
    public void Item1ByTitle()
    {
      var cmd = new Cmd.IndexSearch();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Query = FIELD1_NAME + ":" + _item1Field;
      cmd.Command = "ga -a id";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Contains.Substring(_item1.ID.ToString()));
      Assert.That(result.Message, Contains.Substring("Found 1 item"));
    }
예제 #4
0
    public void InvalidIndex()
    {
      var cmd = new Cmd.IndexSearch();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Query = "foo:bar";
      cmd.Command = "ga -a id";
      cmd.IndexName = "invalidIndexName";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
예제 #5
0
    public void NoMatches()
    {
      var cmd = new Cmd.IndexSearch();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Query = "foo:bar";
      cmd.Command = "ga -a id";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Contains.Substring("Found 0 items"));
    }
예제 #6
0
    public void StatsOnly()
    {
      var cmd = new Cmd.IndexSearch();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Query = FIELD1_NAME + ":" + _item1Field + " or " + FIELD2_NAME + ":" + _item2Field;
      cmd.StatsOnly = true;

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Contains.Substring("2"));
      Assert.That(result.Message, Is.Not.ContainsSubstring("Found"));
    }
예제 #7
0
    public void Item2ByText()
    {
      var cmd = new Cmd.IndexSearch();
      InitCommand(cmd);

      _context.CurrentItem = _testRoot;
      cmd.Query = FIELD2_NAME + ":" + _item2Field;
      cmd.Command = "pwd";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Contains.Substring(_item2.Paths.FullPath));
      Assert.That(result.Message, Contains.Substring("Found 1 item"));
    }