示例#1
0
        public void TestLocaleAwareCompare()
        {
            var r1         = new Random();
            var i1         = r1.Next(0, 60);
            var netString1 = Helper.RandomString(i1);
            var qString1   = new QStringRef(netString1);

            System.Threading.Thread.Sleep(50);

            var r2         = new Random();
            var i2         = r2.Next(0, 60);
            var netString2 = Helper.RandomString(i2);
            var qString2   = new QStringRef(netString2);

            var netRes = string.Compare(netString1, netString2);

            var qRes = QStringRef.LocaleAwareCompare(qString1, netString2);

            Assert.AreEqual(netRes, qRes);
        }
示例#2
0
        public void TestLocaleAwareCompare()
        {
            var r1         = new Random();
            var i1         = r1.Next(0, 60);
            var netString1 = Helper.RandomString(i1);
            int netRes;
            int qRes;

            using (var qString1 = new QStringRef(netString1))
            {
                System.Threading.Thread.Sleep(50);

                var r2         = new Random();
                var i2         = r2.Next(0, 60);
                var netString2 = Helper.RandomString(i2);

                netRes = string.Compare(netString1, netString2, StringComparison.CurrentCulture);

                qRes = QStringRef.LocaleAwareCompare(qString1, netString2);
            }

            Assert.AreEqual(netRes, qRes);
        }