public void Int16Key_Ordering() { Int16Key key1 = Int16Key.Create(1, "Product"); Int16Key key2 = Int16Key.Create(2, "Product"); Int16Key key3 = Int16Key.Create(3, "Product"); Int16Key key4 = Int16Key.Create(4, "Product"); Int16Key key5 = Int16Key.Create(1, "Term"); Int16Key key6 = Int16Key.Create(2, "Term"); Int16Key key7 = Int16Key.Create(3, "Term"); Int16Key key8 = Int16Key.Create(4, "Term"); List <Int16Key> list = new List <Int16Key>() { key5, key4, key3, key7, key6, key8, key1, key2 }; list.Sort(); Assert.AreEqual(list[0], Int16Key.Create(1, "Product")); Assert.AreEqual(list[1], Int16Key.Create(2, "Product")); Assert.AreEqual(list[2], Int16Key.Create(3, "Product")); Assert.AreEqual(list[3], Int16Key.Create(4, "Product")); Assert.AreEqual(list[4], Int16Key.Create(1, "Term")); Assert.AreEqual(list[5], Int16Key.Create(2, "Term")); Assert.AreEqual(list[6], Int16Key.Create(3, "Term")); Assert.AreEqual(list[7], Int16Key.Create(4, "Term")); }
public void Int16Key_Equal() { Int16Key key1 = Int16Key.Create(1, "Product"); Int16Key key2 = Int16Key.Create(1, "Product"); Assert.AreEqual(key1, key2); key1 = Int16Key.Create(1, "Product"); key2 = Int16Key.Create(2, "Product"); Assert.AreNotEqual(key1, key2); key1 = Int16Key.Create(1, "Product"); key2 = Int16Key.Create(1, "Term"); Assert.AreNotEqual(key1, key2); }