Ejemplo n.º 1
0
 public void RemoveWithCurrentEmpty()
 {
   cmd = new Cmd.ListManipulator();
   base.InitCommand(cmd);
   cmd.Remove = true;
   cmd.Delimiter = "-";
   cmd.Element = "a";
   CommandResult result = cmd.Run();
   Assert.AreEqual(CommandStatus.Success, result.Status);
   Assert.AreEqual("", result.Message);
 }
Ejemplo n.º 2
0
 public void Add()
 {
   cmd = new Cmd.ListManipulator();
   base.InitCommand(cmd);
   cmd.Add = true;
   cmd.Input = "a-b-c";
   cmd.Delimiter = "-";
   cmd.Element = "d";
   CommandResult result = cmd.Run();
   Assert.AreEqual(CommandStatus.Success, result.Status);
   Assert.AreEqual("a-b-c-d", result.Message);
 }
Ejemplo n.º 3
0
    public void AddWithAlreadyExists()
    {
      string id1 = ID.NewID.ToString();
      string id2 = ID.NewID.ToString();
      string id3 = ID.NewID.ToString();
      string input = id1 + "|" + id2 + "|" + id3;

      cmd = new Cmd.ListManipulator();
      base.InitCommand(cmd);
      cmd.Add = true;
      cmd.Input = input;
      cmd.Delimiter = "|";
      cmd.Element = id2;
      CommandResult result = cmd.Run();
      Assert.AreEqual(CommandStatus.Success, result.Status);
      Assert.AreEqual(input, result.Message);
    }
Ejemplo n.º 4
0
    public void Shuffle()
    {
      cmd = new Cmd.ListManipulator(42);
      base.InitCommand(cmd);

      cmd.Input = "a-b-c";
      cmd.Delimiter = "-";
      cmd.Shuffle = true;

      var result = cmd.Run();
      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));

      // This test won't always pass as the random soring may resort in the original order
      Assert.That(result.Message, Is.Not.EqualTo("a-b-c"));
      Assert.That(result.Message, Is.StringMatching(@"\w-\w-\w"));
    }
Ejemplo n.º 5
0
    public void AlphabeticalAndShuffle()
    {
      cmd = new Cmd.ListManipulator(42);
      base.InitCommand(cmd);

      cmd.Input = "a-b-c";
      cmd.Delimiter = "-";
      cmd.OrderList = true;
      cmd.Shuffle = true;

      var result = cmd.Run();
      Assert.That(result.Status, Is.EqualTo(CommandStatus.Failure));
    }
Ejemplo n.º 6
0
    public void ReverseOrder()
    {
      cmd = new Cmd.ListManipulator();
      base.InitCommand(cmd);

      cmd.Input = "a-b-c";
      cmd.Delimiter = "-";
      cmd.OrderList = true;
      cmd.ReverseOrder = true;
      
      var result = cmd.Run();
      Assert.That(result.Status, Is.EqualTo(CommandStatus.Success));
      Assert.That(result.Message, Is.EqualTo("c-b-a"));
    }
Ejemplo n.º 7
0
 public void MissingElement()
 {
   cmd = new Cmd.ListManipulator();
   base.InitCommand(cmd);
   cmd.Remove = true;
   cmd.Input = "a-b-c";
   cmd.Delimiter = "-";
   CommandResult result = cmd.Run();
   Assert.AreEqual(CommandStatus.Failure, result.Status);
 }