public void TestThisIndexer() { KeyDef keyDef = new KeyDef("mykey"); KeyDefColInheritor col = new KeyDefColInheritor(); col.Add(keyDef); Assert.AreEqual(keyDef, col.GetThis("mykey")); }
public void TestRemove() { KeyDef keyDef = new KeyDef(); KeyDefColInheritor col = new KeyDefColInheritor(); col.CallRemove(keyDef); col.Add(keyDef); Assert.AreEqual(1, col.Count); col.CallRemove(keyDef); Assert.AreEqual(0, col.Count); }
public void TestThisIndexerException() { //---------------Set up test pack------------------- KeyDefColInheritor col = new KeyDefColInheritor(); //---------------Execute Test ---------------------- try { col.GetThis("mykey"); Assert.Fail("Expected to throw an ArgumentException"); } //---------------Test Result ----------------------- catch (ArgumentException ex) { StringAssert.Contains("does not exist in the collection of key definitions", ex.Message); } }