Example #1
0
 public void TestInvalidValidation()
 {
     Assert.IsFalse(TagRegistry.ValidateTag("de-419-DE"));            //two region tags
     Assert.IsFalse(TagRegistry.ValidateTag("a-DE"));                 //(use of a single-character subtag in primary position; note
                                                                      //that there are a few grandfathered tags that start with "i-" that are valid
     Assert.IsFalse(TagRegistry.ValidateTag("ar-a-aaa-b-bbb-a-ccc")); //two extensions with same single-letter prefix
 }
Example #2
0
        public void TestPrivateUseValidation()
        {
            LanguageTag result = null;

            Assert.IsTrue(TagRegistry.TryParse("x-a", out result));
            Assert.AreEqual("x-a", result.Value, ignoreCase);
            Assert.IsTrue(TagRegistry.TryParse("x-aaaaaaaa", out result));
            Assert.AreEqual("x-aaaaaaaa", result.Value, ignoreCase);

            Assert.IsFalse(TagRegistry.ValidateTag("x-aaaaaaaaa"));
            Assert.IsFalse(TagRegistry.ValidateTag("xaaaaaaaa"));
        }