public void QbKeyNormalizeTest3() { // Forward slash is replaced with backslash var s = "a/b"; Assert.AreEqual("a\\b", QbKey.Normalize(s)); }
public void QbKeyNormalizeTest1() { // Lowercase string with no / is unchanged var n = (int)TestContext.CurrentContext.Random.NextUInt(40); var s = TestContext.CurrentContext.Random.GetString(n, "abcdefghijklmnopqrstuvwxyz"); Assert.AreEqual(s, QbKey.Normalize(s)); }
public void QbKeyNormalizeTest2() { // Uppercase string with no / is made lowercase var n = (int)TestContext.CurrentContext.Random.NextUInt(40); var s = TestContext.CurrentContext.Random.GetString(n, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); Assert.AreEqual(s.ToLowerInvariant(), QbKey.Normalize(s)); }
public void QbKeyStringTestNormalize() { string s = TestContext.CurrentContext.Random.GetString(); var latin1 = Encoding.GetEncoding("iso-8859-1"); var qbKey = new QbKey(s, true); s = QbKey.Normalize(s); var crc = new CRC32().ComputeHash(latin1.GetBytes(s)); Assert.AreEqual(~BitConverter.ToUInt32(crc, 0), qbKey.Checksum); }