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)); }
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)); }
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)); }
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")); }
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")); }
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")); }
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")); }