Ejemplo n.º 1
0
    public void MissingCommand()
    {
      var cmd = new Cmd.SitecoreQuery();
      InitCommand(cmd);
      _context.CurrentItem = _testContent;

      cmd.Query = "*";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
Ejemplo n.º 2
0
    public void FastQueryWithPath()
    {
      var cmd = new Cmd.SitecoreQuery();
      InitCommand(cmd);
      _context.CurrentItem = _testContent;

      cmd.Query = "fast://sitecore/content/*";
      cmd.Path = "..";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
Ejemplo n.º 3
0
    public void CommandAndStats()
    {
      var cmd = new Cmd.SitecoreQuery();
      InitCommand(cmd);
      _context.CurrentItem = _testContent;

      cmd.StatisticsOnly = true;
      cmd.Command = "pwd";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
Ejemplo n.º 4
0
    public void NormalQuery()
    {
      var cmd = new Cmd.SitecoreQuery();
      InitCommand(cmd);
      _context.CurrentItem = _testContent;

      cmd.Query = "*";
      cmd.Command = "pwd";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Contains.Substring("Laomedeia"));
      Assert.That(result.Message, Contains.Substring("Neso"));
      Assert.That(result.Message, Contains.Substring("Proteus"));
      Assert.That(result.Message, Contains.Substring("Thalassa"));
      Assert.That(result.Message, Contains.Substring("Triton"));
      Assert.That(result.Message, Contains.Substring("Found 5 items"));
    }
Ejemplo n.º 5
0
    public void QueryMaximumResults()
    {
      // note: this test may fail if the host instance has changed the MaxQueryResults setting
      var cmd = new Cmd.SitecoreQuery();
      InitCommand(cmd);
      _context.CurrentItem = _context.CurrentDatabase.GetRootItem();

      cmd.Query = "//*";
      cmd.Command = "pwd";

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Contains.Substring("Number of results equals the maximum query items length"));
    }
Ejemplo n.º 6
0
    public void NoStats()
    {
      var cmd = new Cmd.SitecoreQuery();
      InitCommand(cmd);
      _context.CurrentItem = _context.CurrentDatabase.GetRootItem();

      cmd.Query = _testContent.Paths.FullPath + "/*";
      cmd.Command = "pwd";
      cmd.NoStatistics = true;

      var result = cmd.Run();

      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Contains.Substring("Laomedeia"));
      Assert.That(result.Message, Contains.Substring("Neso"));
      Assert.That(result.Message, Contains.Substring("Proteus"));
      Assert.That(result.Message, Contains.Substring("Thalassa"));
      Assert.That(result.Message, Contains.Substring("Triton"));
      Assert.That(result.Message, Is.Not.ContainsSubstring("5 items"));
    }
Ejemplo n.º 7
0
    public void StatsOnly()
    {
      var cmd = new Cmd.SitecoreQuery();
      InitCommand(cmd);
      _context.CurrentItem = _testContent;

      cmd.Query = "*";
      cmd.StatisticsOnly = true;

      var result = cmd.Run();

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