public static void TestIntersectWithRest() { OrderableStrings strings = new OrderableStrings { "W", { "E", -1 }, { "Y", 3 }, { "U", 0 }, "I" }; IEnumerable <string> stringsList = new List <string>() { "W", "a", "f", "U" }; Strings stringsReturn = new Strings(); Strings stringsTestReturn = new Strings { "a", "E", "f", "I", "Y" }; strings.IntersectWith(stringsList, stringsReturn); Assert.AreEqual(stringsTestReturn.ToString(), stringsReturn.ToString()); Assert.AreEqual("W,U", strings.ToString()); }
public static void TestRemoveBetween() { OrderableStrings strings = new OrderableStrings { "W", { "U", 0 }, "I" }; Assert.True(strings.Remove("U")); Assert.AreEqual("W,I", strings.ToString()); }
public static void TestRemoveAt() { OrderableStrings strings = new OrderableStrings { { "W", -4 }, { "E", -1 }, }; strings.RemoveAt(1); Assert.AreEqual("W", strings.ToString()); Assert.AreEqual(-4, strings.GetOrderNumber(0)); }
public static void TestToLower() { OrderableStrings strings = new OrderableStrings { "W", { "E", -1 }, "O" }; strings.ToLower(); Assert.AreEqual("w,e,o", strings.ToString()); }
public static void TestInsertPrefix() { OrderableStrings strings = new OrderableStrings { "LLA", "YA", { "UT", -3 } }; strings.InsertPrefix("H"); Assert.AreEqual("HLLA,HYA,HUT", strings.ToString()); }
public static void TestInsert() { OrderableStrings strings = new OrderableStrings { "LLA", "YA", { "UT", -3 } }; strings.Insert(2, "test-insert"); Assert.AreEqual("LLA,YA,test-insert,UT", strings.ToString()); }
public static void TestInsertSuffix() { OrderableStrings strings = new OrderableStrings { "LL", "Y", { "UT", -3 } }; strings.InsertSuffix("A"); Assert.AreEqual("LLA,YA,UTA", strings.ToString()); }
public static void TestInsertSuffixOnlyIfAbsent() { OrderableStrings strings = new OrderableStrings { "LLA", "YA", { "UT", -3 } }; strings.InsertSuffix("A", true); Assert.AreEqual("LLA,YA,UTA", strings.ToString()); }
public static void TestInsertPrefixSuffix() { OrderableStrings strings = new OrderableStrings { "LL", "Y", { "UT", -3 } }; strings.InsertPrefixSuffix("A", "O"); Assert.AreEqual("ALLO,AYO,AUTO", strings.ToString()); }
public static void TestRemoveNotInclude() { OrderableStrings strings = new OrderableStrings { "W", { "E", -1 }, { "Y", 3 }, { "U", 0 }, "I" }; Assert.False(strings.Remove("o")); Assert.AreEqual("W,E,Y,U,I", strings.ToString()); }
public static void TestStableSortWithNoOrder() { OrderableStrings strings = new OrderableStrings { "b", "c", "a", "d" }; strings.StableSort(); Assert.AreEqual("b,c,a,d", strings.ToString()); }
public static void TestRemoveLast() { OrderableStrings strings = new OrderableStrings { "W", { "E", -1 }, { "Y", 3 }, { "U", 0 }, "I" }; Assert.True(strings.Remove("I")); Assert.AreEqual("W,E,Y,U", strings.ToString()); }
public static void TestAddStringTab() { OrderableStrings strings = new OrderableStrings { "A", "Y" }; string[] stringTab = { "W", "E" }; strings.Add(stringTab); Assert.AreEqual(4, strings.Count); Assert.AreEqual("A,Y,W,E", strings.ToString()); }
public static void TestRemoveAtIndex() { OrderableStrings strings = new OrderableStrings { { "W", -4 }, { "E", -1 }, { "Y", 3 }, { "U", 0 }, { "I", -3 }, { "A", 6 } }; Assert.AreEqual(0, strings.SetOrRemoveAtIndex(0, "H")); Assert.AreEqual(3, strings.SetOrRemoveAtIndex(4, "H")); Assert.AreEqual("H,E,Y,U,A", strings.ToString()); }
public static void TestSetAtIndexSameValue() { OrderableStrings strings = new OrderableStrings { { "W", -4 }, { "E", -1 }, { "Y", 3 }, { "U", 0 }, { "I", -3 }, { "A", 6 } }; Assert.AreEqual("W,E,Y,U,I,A", strings.ToString()); Assert.AreEqual(0, strings.SetOrRemoveAtIndex(0, "W")); Assert.AreEqual(-4, strings.GetOrderNumber(0)); }
public static void TestAddRangeIEnumerable() { OrderableStrings strings = new OrderableStrings { "W" }; IEnumerable <string> stringsList = new List <string>() { "h", "J" }; strings.AddRange(stringsList); Assert.AreEqual(3, strings.Count); Assert.AreEqual("W,h,J", strings.ToString()); }
public static void TestAddStringInt() { OrderableStrings strings = new OrderableStrings { "A", { "Y", -1 } }; strings.Add("W", -4); strings.Add("A", -4); strings.Add("E", 1); strings.Add("B", 0); Assert.AreEqual("A,Y,W,E,B", strings.ToString()); Assert.AreEqual(-4, strings.GetOrderNumber(0)); Assert.AreEqual(-4, strings.GetOrderNumber(2)); Assert.AreEqual(1, strings.GetOrderNumber(3)); Assert.AreEqual(0, strings.GetOrderNumber(4)); }
public static void TestRemoveRangeBetweenFirst() { IEnumerable <string> stringsList = new List <string>() { "E", "U", "W" }; OrderableStrings strings = new OrderableStrings { "W", { "E", -1 }, { "Y", 3 }, { "U", 0 }, "I" }; strings.RemoveRange(stringsList); Assert.AreEqual(2, strings.Count); Assert.AreEqual("Y,I", strings.ToString()); }
public static void TestRemoveRangeNotInclude() { IEnumerable <string> stringsList = new List <string>() { "l", "a", "f", "q" }; OrderableStrings strings = new OrderableStrings { "W", { "E", -1 }, { "Y", 3 }, { "U", 0 }, "I" }; strings.RemoveRange(stringsList); Assert.AreEqual(5, strings.Count); Assert.AreEqual("W,E,Y,U,I", strings.ToString()); }
public static void TestIntersectWithNoRest() { OrderableStrings strings = new OrderableStrings { "W", { "E", -1 }, { "Y", 3 }, { "U", 0 }, "I" }; IEnumerable <string> stringsList = new List <string>() { "W", "a", "f", "U" }; strings.IntersectWith(stringsList); Assert.AreEqual(2, strings.Count); Assert.AreEqual("W,U", strings.ToString()); }