예제 #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);
 }
예제 #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);
 }
예제 #3
0
    public void Remove()
    {
      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.Remove = true;
      cmd.Input = input;
      cmd.Delimiter = "|";
      cmd.Element = id2;
      CommandResult result = cmd.Run();
      Assert.AreEqual(CommandStatus.Success, result.Status);
      Assert.AreEqual(id1 + "|" + id3, result.Message);
    }
예제 #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"));
    }
예제 #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));
    }
예제 #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"));
    }
예제 #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);
 }