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