예제 #1
0
        public void Int64Key_Ordering()
        {
            Int64Key key1 = Int64Key.Create(1, "Product");
            Int64Key key2 = Int64Key.Create(2, "Product");
            Int64Key key3 = Int64Key.Create(3, "Product");
            Int64Key key4 = Int64Key.Create(4, "Product");

            Int64Key key5 = Int64Key.Create(1, "Term");
            Int64Key key6 = Int64Key.Create(2, "Term");
            Int64Key key7 = Int64Key.Create(3, "Term");
            Int64Key key8 = Int64Key.Create(4, "Term");

            List <Int64Key> list = new List <Int64Key>()
            {
                key5, key4, key3, key7, key6, key8, key1, key2
            };

            list.Sort();

            Assert.AreEqual(list[0], Int64Key.Create(1, "Product"));
            Assert.AreEqual(list[1], Int64Key.Create(2, "Product"));
            Assert.AreEqual(list[2], Int64Key.Create(3, "Product"));
            Assert.AreEqual(list[3], Int64Key.Create(4, "Product"));
            Assert.AreEqual(list[4], Int64Key.Create(1, "Term"));
            Assert.AreEqual(list[5], Int64Key.Create(2, "Term"));
            Assert.AreEqual(list[6], Int64Key.Create(3, "Term"));
            Assert.AreEqual(list[7], Int64Key.Create(4, "Term"));
        }
예제 #2
0
        public void Int64Key_Equal()
        {
            Int64Key key1 = Int64Key.Create(1, "Product");
            Int64Key key2 = Int64Key.Create(1, "Product");

            Assert.AreEqual(key1, key2);

            key1 = Int64Key.Create(1, "Product");
            key2 = Int64Key.Create(2, "Product");
            Assert.AreNotEqual(key1, key2);

            key1 = Int64Key.Create(1, "Product");
            key2 = Int64Key.Create(1, "Term");
            Assert.AreNotEqual(key1, key2);
        }