public void EncodingIsOrderPreserving()
        {
            RandUtils randUtils = new RandUtils();

            List <ulong>  listOfNumbers   = new List <ulong>();
            List <string> listOfEncodings = new List <string>();

            // Generate 100,000 ulongs and insert them in a list
            for (int i = 0; i < NumUlongs; i += 1)
            {
                listOfNumbers.Add(randUtils.GenerateRandomUlong());
            }

            // Sort the list of numbers
            listOfNumbers.Sort();

            // Encode the numbers one by one and insert them in the list in order
            for (int i = 0; i < NumUlongs; i += 1)
            {
                listOfEncodings.Add(new string(Base64OrderPreservingAzureCompatEncoding.Encode(listOfNumbers[i], Base64OrderPreservingAzureCompatEncoding.SortOrders.Ordinal)));
            }

            // Check that the list of encoding numbers is already sorted
            List <string> orderedListOfEncodings = listOfEncodings.OrderBy(x => x, StringComparer.Ordinal).ToList();

            CollectionAssert.AreEqual(listOfEncodings, orderedListOfEncodings);
        }
        public void EncodeDecode()
        {
            RandUtils randUtils = new RandUtils();

            // The Assert is placed in the for-loop so that if we fail, we fail early
            for (int i = 0; i < NumUlongs; i += 1)
            {
                ulong  current         = randUtils.GenerateRandomUlong();
                char[] ordinalEncoding = Base64OrderPreservingAzureCompatEncoding.Encode(current, Base64OrderPreservingAzureCompatEncoding.SortOrders.Ordinal);
                Assert.AreEqual(current, Base64OrderPreservingAzureCompatEncoding.Decode(ordinalEncoding, Base64OrderPreservingAzureCompatEncoding.SortOrders.Ordinal));
                char[] lexiEncoding = Base64OrderPreservingAzureCompatEncoding.Encode(current, Base64OrderPreservingAzureCompatEncoding.SortOrders.Lexicographic);
                Assert.AreEqual(current, Base64OrderPreservingAzureCompatEncoding.Decode(lexiEncoding, Base64OrderPreservingAzureCompatEncoding.SortOrders.Lexicographic));
            }
        }