public void TestMoving() { ReactiveList <string> list = new ReactiveArrayList <string> { "A", "B", "C" }; Assert.AreEqual(3, list.Count); list.Move("B", list.Count - 1); Assert.AreEqual(3, list.Count); Assert.IsTrue(list.SequenceEqual(new[] { "A", "C", "B" })); list.Move("A", 0); Assert.AreEqual(3, list.Count); Assert.IsTrue(list.SequenceEqual(new[] { "A", "C", "B" })); }
public void TestMovingMultipleOccurrences() { ReactiveList <string> list = new ReactiveArrayList <string> { "A", "B", "A", "C" }; list.Move("A", list.Count - 1); Assert.IsTrue(list.SequenceEqual(new[] { "B", "A", "C", "A" })); }
public void TestAdding() { ReactiveList <string> list = new ReactiveArrayList <string>(); Assert.AreEqual(0, list.Count); list.Add("B"); Assert.AreEqual(1, list.Count); list.Insert(0, "A"); list.Insert(2, "C"); Assert.IsTrue(list.SequenceEqual(new[] { "A", "B", "C" })); }
public void TestRemoving() { ReactiveList <string> list = new ReactiveArrayList <string> { "A", "B", "C" }; Assert.AreEqual(3, list.Count); Assert.IsTrue(list.Remove("B")); Assert.AreEqual(2, list.Count); list.RemoveAt(1); list.RemoveAt(0); Assert.IsTrue(list.SequenceEqual(new string[0])); }