Beispiel #1
0
    public void ContainsChildren()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      _context.CurrentItem = _listRoot.Axes.GetChild("Luna");

      var result = cmd.Run();

      Assert.IsTrue(result.Message.Contains("Carme"));
      Assert.IsTrue(result.Message.Contains("Ganymede"));
      Assert.IsTrue(result.Message.Contains("Metis"));
    }
Beispiel #2
0
    public void ListRootNode()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      _context.CurrentItem = _listRoot;
      var result = cmd.Run();

      Assert.AreEqual(CommandStatus.Success, result.Status);

      Assert.IsTrue(result.Message.Contains("+ Luna"));
      Assert.IsTrue(result.Message.Contains("Deimos"));
      Assert.IsTrue(result.Message.Contains("phobos"));
      Assert.IsTrue(result.Message.Contains("Adrastea Phobos"));
    }
Beispiel #3
0
    public void NoChildren()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      _context.CurrentItem = _listRoot.Axes.GetChild("Deimos");

      var result = cmd.Run();

      Assert.IsTrue(result.Message.Contains("zero items found"));
    }
Beispiel #4
0
    public void AbsolutePath()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      cmd.Path = _listRoot.Paths.FullPath;

      _context.CurrentItem = _context.CurrentDatabase.GetRootItem();
      var result = cmd.Run();

      Assert.AreEqual(CommandStatus.Success, result.Status);

      Assert.IsTrue(result.Message.Contains("+ Luna"));
      Assert.IsTrue(result.Message.Contains("Deimos"));
      Assert.IsTrue(result.Message.Contains("phobos"));
      Assert.IsTrue(result.Message.Contains("Adrastea Phobos"));
    }
Beispiel #5
0
    public void RelativePathUp()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      cmd.Path = "..";

      _context.CurrentItem = _listRoot.Axes.GetChild("Luna");
      var result = cmd.Run();

      Assert.AreEqual(CommandStatus.Success, result.Status);

      Assert.IsTrue(result.Message.Contains("+ Luna"));
      Assert.IsTrue(result.Message.Contains("Deimos"));
      Assert.IsTrue(result.Message.Contains("phobos"));
      Assert.IsTrue(result.Message.Contains("Adrastea Phobos"));
    }
Beispiel #6
0
    public void RelativePathDown()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      cmd.Path = "Luna";

      _context.CurrentItem = _listRoot;
      var result = cmd.Run();

      Assert.AreEqual(CommandStatus.Success, result.Status);

      Assert.IsTrue(result.Message.Contains("Carme"));
      Assert.IsTrue(result.Message.Contains("Ganymede"));
      Assert.IsTrue(result.Message.Contains("Metis"));
    }
Beispiel #7
0
    public void ReverseAlphabetical()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      cmd.Alphabetical = true;
      cmd.ReverseOrder = true;

      _context.CurrentItem = _listRoot;
      var result = cmd.Run();

      Assert.AreEqual(CommandStatus.Success, result.Status);

      Assert.IsTrue(Regex.IsMatch(result.Message, @"\s+phobos\s+\+\sLuna\s+Deimos\s+Adrastea Phobos"));
    }
Beispiel #8
0
    public void ByCaseSensitiveRegex()
    {
      var cmd = new Cmd.List();
      InitCommand(cmd);

      cmd.Regex = "phobos";
      cmd.CaseSensitiveRegex = true;

      _context.CurrentItem = _listRoot;
      var result = cmd.Run();

      Assert.AreEqual(CommandStatus.Success, result.Status);

      Assert.IsTrue(result.Message.Contains("phobos"));
    }