Esempio n. 1
0
        public void Compare_secondnull_throws()
        {
            byte[]  keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey = Collator.CreateSortKey("heo", keyData);

            Assert.Throws <ArgumentNullException>(() => SortKey.Compare(sortKey, null));
        }
Esempio n. 2
0
        public void Compare_firstnull_throws()
        {
            byte[]  keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey = Collator.CreateSortKey("heo", keyData);

            SortKey.Compare(null, sortKey);
        }
Esempio n. 3
0
        public void Compare_secondnull_throws()
        {
            byte[]  keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey = Collator.CreateSortKey("heo", keyData);

            SortKey.Compare(sortKey, null);
        }
Esempio n. 4
0
        public void Compare_keyDataSame_same()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heo", keyData);
            SortKey sortKey2 = Collator.CreateSortKey("heol", keyData);

            Assert.AreEqual(Same, SortKey.Compare(sortKey1, sortKey2));
        }
Esempio n. 5
0
        public void Compare_SamePrefixSecondShorter_follows()
        {
            byte[]  keyData1 = new byte[] { 0xae, 0x1, 0x20, 0x30, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heol", keyData1);

            byte[]  keyData2 = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey2 = Collator.CreateSortKey("heo", keyData2);

            Assert.AreEqual(Follows, SortKey.Compare(sortKey1, sortKey2));
        }
Esempio n. 6
0
        public void Compare_SamePrefixSecondLonger_precedes()
        {
            byte[]  keyData1 = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heo", keyData1);

            byte[]  keyData2 = new byte[] { 0xae, 0x1, 0x20, 0x32, 0x1 };
            SortKey sortKey2 = Collator.CreateSortKey("heol", keyData2);

            Assert.AreEqual(Precedes, SortKey.Compare(sortKey1, sortKey2));
        }
Esempio n. 7
0
        public void Compare_SecondGreater_precedes()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heol", keyData);

            keyData[0] = 0xaf;
            SortKey sortKey2 = Collator.CreateSortKey("heo", keyData);

            Assert.AreEqual(Precedes, SortKey.Compare(sortKey1, sortKey2));
        }
Esempio n. 8
0
        public void Compare_SecondLesser_follows()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heol", keyData);

            keyData[0] = 0xad;
            SortKey sortKey2 = Collator.CreateSortKey("heo", keyData);

            Assert.AreEqual(Follows, SortKey.Compare(sortKey1, sortKey2));
        }
Esempio n. 9
0
        public void Compare_keyDataByteChanges_NotAffected()
        {
            byte[]  keyData  = new byte[] { 0xae, 0x1, 0x20, 0x1 };
            SortKey sortKey1 = Collator.CreateSortKey("heo", keyData);

            keyData[2] = 0x21;
            SortKey sortKey2 = Collator.CreateSortKey("hao", keyData);

            Assert.AreEqual(Precedes, SortKey.Compare(sortKey1, sortKey2));
        }
Esempio n. 10
0
 public void SortKey_nullKeyData_Throws()
 {
     Assert.Throws <ArgumentNullException>(() => Collator.CreateSortKey("hello", null));
 }
Esempio n. 11
0
 public void SortKey_nullOriginalString_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.Throws <ArgumentNullException>(() => Collator.CreateSortKey(null, keyData));
 }
Esempio n. 12
0
 public void ConstructSortKey()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.IsNotNull(Collator.CreateSortKey("iou", keyData));
 }
Esempio n. 13
0
 public void SortKey_nullOriginalString_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey(null, keyData);
 }
Esempio n. 14
0
 public void SortKey_KeyDataLengthNegative_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey("hello", keyData, -1);
 }
Esempio n. 15
0
 public void SortKey_KeyDataLengthTooLarge_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Collator.CreateSortKey("hello", keyData, keyData.Length + 1);
 }
Esempio n. 16
0
 public void SortKey_nullKeyData_Throws()
 {
     Collator.CreateSortKey("hello", null);
 }
Esempio n. 17
0
 public void SortKey_KeyDataLengthNegative_Throws()
 {
     byte[] keyData = new byte[] { 0xae, 0x1, 0x20, 0x1 };
     Assert.Throws <ArgumentOutOfRangeException>(() => Collator.CreateSortKey("hello", keyData, -1));
 }