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