public void TestCompareQStringRefAndQStringLatinCaseSensitive()
        {
            var r1 = new Random();
            var i1 = r1.Next(0, 50);

            var netString1 = Helper.RandomString(i1);
            int netRes;
            int qRes;

            using (var qString1 = new QStringRef(netString1))
            {
                var r2 = new Random();
                var i2 = r2.Next(0, 50);

                var netString2 = Helper.RandomString(i2);
                using (var qLString2 = new QLatin1String(netString2))
                {
                    netRes = string.CompareOrdinal(netString1, netString2);

                    qRes = QStringRef.Compare(qString1, qLString2);
                }
            }

            if (netRes == qRes)
            {
                Assert.IsTrue(true);
            }
        }
        public void TestCompareQStringRefAndStringCaseSensitive()
        {
            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.CompareOrdinal(netString1, netString2);

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

            if (netRes == qRes)
            {
                Assert.IsTrue(true);
            }
        }
        public void TestCompareQStringRefAndQStringLatinCaseInsensitive()
        {
            var r1 = new Random();
            var i1 = r1.Next(0, 50);

            var netString1 = Helper.RandomString(i1);
            int netRes;
            int qRes;

            using (var qString1 = new QStringRef(netString1))
            {
                var r2 = new Random();
                var i2 = r2.Next(0, 50);

                var netString2 = Helper.RandomString(i2);
                using (var qLString2 = new QLatin1String(netString2))
                {
                    netRes = string.Compare(netString1, netString2, CultureInfo.CurrentCulture, CompareOptions.IgnoreCase);

                    qRes = QStringRef.Compare(qString1, qLString2, CaseSensitivity.CaseInsensitive);
                }
            }

            if (netRes == qRes)
            {
                Assert.IsTrue(true);
            }
        }
Exemple #4
0
        public void TestCompareQStringRefAndStringCaseSensitive()
        {
            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, false);

            var qRes = QStringRef.Compare(qString1, netString2, CaseSensitivity.CaseSensitive);

            if (netRes == qRes)
            {
                Assert.IsTrue(true);
            }
        }