public void Constructor_Default() { UnitTestNameObjectCollectionBase coll = new UnitTestNameObjectCollectionBase(); Assert.AreEqual(0, coll.Count, "Count-0"); Assert.IsFalse(coll._IsReadOnly, "IsReadOnly"); Assert.IsFalse(coll.HasKeys(), "HasKeys-0"); coll.Add("a", "1"); CheckICollection(coll, 1); Assert.AreEqual(1, coll.Count, "Count-1"); Assert.AreEqual("1", coll.Get(0), "Get(0)"); Assert.AreEqual(1, coll.GetAllKeys().Length, "GetAllKeys"); Assert.IsTrue(coll.HasKeys(), "HasKeys-1"); coll.Add("b", "2"); Assert.AreEqual(2, coll.Count, "Count-2"); Assert.AreEqual("b", coll.GetKey(1), "GetKey(1)"); Assert.AreEqual(2, coll.GetAllValues().Length, "GetAllValues"); coll.Remove("a"); Assert.AreEqual(1, coll.Count, "Count-3"); coll.Set(0, "3"); Assert.AreEqual("3", coll.Get(0), "Get(0)b"); coll.Set("b", "4"); Assert.AreEqual("4", coll.Get(0), "Get(0)c"); coll.RemoveAt(0); Assert.AreEqual(0, coll.Count, "Count-4"); Assert.IsFalse(coll.HasKeys(), "HasKeys-2"); }
public void GetAllValues_Type_Mismatch() { UnitTestNameObjectCollectionBase coll = new UnitTestNameObjectCollectionBase(); coll.Add("a", "string"); coll.Add("b", Int32.MinValue); string[] array = (string[])coll.GetAllValues(typeof(string)); Assert.AreEqual(1, array.Length, "Length"); Assert.AreEqual("string", array[0], "[0]"); }
public void GetAllValues() { UnitTestNameObjectCollectionBase coll = new UnitTestNameObjectCollectionBase(); coll.Add("a", "string1"); coll.Add("b", "string2"); object[] array = (object[])coll.GetAllValues(); Assert.AreEqual(2, array.Length, "Length"); Assert.AreEqual("string1", array[0], "[0]"); Assert.AreEqual("string2", array[1], "[1]"); }
public void GetAllValues () { UnitTestNameObjectCollectionBase coll = new UnitTestNameObjectCollectionBase (); coll.Add ("a", "string1"); coll.Add ("b", "string2"); object[] array = (object[]) coll.GetAllValues (); Assert.AreEqual (2, array.Length, "Length"); Assert.AreEqual ("string1", array[0], "[0]"); Assert.AreEqual ("string2", array[1], "[1]"); }
public void GetAllValues_Type_Mismatch () { UnitTestNameObjectCollectionBase coll = new UnitTestNameObjectCollectionBase (); coll.Add ("a", "string"); coll.Add ("b", Int32.MinValue); string[] array = (string[]) coll.GetAllValues (typeof (string)); Assert.AreEqual (1, array.Length, "Length"); Assert.AreEqual ("string", array[0], "[0]"); }
public void Constructor_Default () { UnitTestNameObjectCollectionBase coll = new UnitTestNameObjectCollectionBase (); Assert.AreEqual (0, coll.Count, "Count-0"); Assert.IsFalse (coll._IsReadOnly, "IsReadOnly"); Assert.IsFalse (coll.HasKeys (), "HasKeys-0"); coll.Add ("a", "1"); CheckICollection (coll, 1); Assert.AreEqual (1, coll.Count, "Count-1"); Assert.AreEqual ("1", coll.Get (0), "Get(0)"); Assert.AreEqual (1, coll.GetAllKeys ().Length, "GetAllKeys"); Assert.IsTrue (coll.HasKeys (), "HasKeys-1"); coll.Add ("b", "2"); Assert.AreEqual (2, coll.Count, "Count-2"); Assert.AreEqual ("b", coll.GetKey (1), "GetKey(1)"); Assert.AreEqual (2, coll.GetAllValues ().Length, "GetAllValues"); coll.Remove ("a"); Assert.AreEqual (1, coll.Count, "Count-3"); coll.Set (0, "3"); Assert.AreEqual ("3", coll.Get (0), "Get(0)b"); coll.Set ("b", "4"); Assert.AreEqual ("4", coll.Get (0), "Get(0)c"); coll.RemoveAt (0); Assert.AreEqual (0, coll.Count, "Count-4"); Assert.IsFalse (coll.HasKeys (), "HasKeys-2"); }