示例#1
0
        public void Constructor_LanguageIsEmptyAndPrivateUseIsSet_CompleteTagConsistsOnlyOfPrivateUse()
        {
            var tag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "audio");

            Assert.AreEqual("x-audio", tag.CompleteTag);
        }
示例#2
0
        public void Language_SetWithCasedButValidLanguageTag_SetsLanguage()
        {
            var tag = new RFC5646Tag("EN", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.AreEqual("EN", tag.Language);
        }
示例#3
0
        public void AddToPrivateUse_StringToAddContainsNonAlphaNumericCharacter_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("_audio"));
        }
示例#4
0
        public void Region_SetWhileLanguageSubtagIsEmpty_Throws()
        {
            var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "test");

            Assert.Throws <ValidationException>(() => rfcTag.Region = "US");
        }
示例#5
0
        public void Variant_SetWithInvalidVariant_Throws()
        {
            var tag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.Throws <ValidationException>(() => tag.Variant = "bogus");
        }
示例#6
0
        public void Constructor_LanguageSubtagIsQaa_IsValid()
        {
            var rfcTag = new RFC5646Tag("qaa", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.AreEqual("qaa", rfcTag.Language);
        }
示例#7
0
        public void AddToVariant_StringToAddContainsInvalidCharacter_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("1901_bauddha"));
        }
示例#8
0
        public void VariantContainsPart_PartConsistsOfMultiplePartsAndAllPartsAreContainedInVariant_ReturnsFalse()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "1901-bauddha-biske", String.Empty);

            Assert.IsFalse(rfcTag.VariantContains("1901-bauddha"));
        }
示例#9
0
        public void AddToPrivateUse_PrivateUseAlreadyContainsPartsOfStringToAdd_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "audio-test");

            Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("smth-test"));
        }
示例#10
0
        public void AddToPrivateUse_PrivateUseAlreadyContainsStringToAddInDifferentCase_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "AUDIO");

            Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("audio"));
        }
示例#11
0
        public void AddToPrivateUse_StringToAddContainsIllegalCharacters_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("x-audio_test"));
        }
示例#12
0
        public void RFC5646Tag_EmptyConstructor_HasDefaultLanguage()
        {
            var tag = new RFC5646Tag();

            AssertTag(tag, "qaa", string.Empty, string.Empty, string.Empty, string.Empty);
        }
示例#13
0
        public void Parse_HasLanguageAndRegion_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("en-US");

            AssertTag(tag, "en", string.Empty, "US", string.Empty, string.Empty);
        }
示例#14
0
        public void Parse_HasLanguageAndMultipleVariants_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("en-alalc97-aluku");

            AssertTag(tag, "en", string.Empty, string.Empty, "alalc97-aluku", string.Empty);
        }
示例#15
0
        public void AddToVariant_VariantAlreadyContainsPartsOfStringToAdd_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "bauddha-biske", String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("1901-bauddha"));
        }
示例#16
0
        public void VariantContainsPart_PartIsContainedInVariant_ReturnsTrue()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "1901", String.Empty);

            Assert.IsTrue(rfcTag.VariantContains("1901"));
        }
示例#17
0
        public void AddToVariant_VariantAlreadyContainsStringToAddInDifferentCase_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "BisKe", String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("biske"));
        }
示例#18
0
        public void Region_SetWithInvalidRegionTag_Throws()
        {
            var tag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.Throws <ValidationException>(() => tag.Region = "bogus");
        }
示例#19
0
        public void AddToVariant_StringToAddBeginsWithx_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "biske", String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("x-bauddha"));
        }
示例#20
0
        public void Variant_SetStringContainingxAsPart_Throws()
        {
            var tag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.Throws <ValidationException>(() => tag.Variant = "x-1901");
        }
示例#21
0
        public void AddToVariant_StringToAddIsNotValidVariant_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("bogus"));
        }
示例#22
0
        public void Language_SetToEmptyWhenVariantIsNotEmpty_Throws()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "1901", String.Empty);

            Assert.Throws <ValidationException>(() => rfcTag.Language = String.Empty);
        }
示例#23
0
        public void RemoveFromPrivateUse_PrivateUseContainsPartAndNoValidlanguageTag_Throws()
        {
            var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "test");

            Assert.Throws <ValidationException>(() => rfcTag.RemoveFromPrivateUse("x-test"));
        }
示例#24
0
        public void Script_SetWhileLanguageSubtagIsEmpty_Throws()
        {
            var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "test");

            Assert.Throws <ValidationException>(() => rfcTag.Script = "Zxxx");
        }
示例#25
0
        public void PrivateUseContainsPart_PartIsNotContainedInPrivateUse_ReturnsFalse()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty);

            Assert.IsFalse(rfcTag.PrivateUseContains("audio"));
        }
示例#26
0
        public void Variant_SetWhileLanguageSubtagIsEmpty_Throws()
        {
            var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "test");

            Assert.Throws <ValidationException>(() => rfcTag.Variant = "1901");
        }
示例#27
0
        public void PrivateUseContainsPart_PartIsContainedInPrivateUseAndpartDoesNotHavePrependedx_ReturnsTrue()
        {
            var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "audio");

            Assert.IsTrue(rfcTag.PrivateUseContains("audio"));
        }
示例#28
0
        public void Constructor_LanguageIsEmptyAndPrivateUseIsSet_SetsPrivateUse()
        {
            var tag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "audio");

            Assert.AreEqual("x-audio", tag.PrivateUse);
        }
示例#29
0
        public void PrivateUseContainsPart_PartConsistsOfMultiplePartsAndAllPartsAreContainedInPrivateUse_ReturnsFalse()
        {
            var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "test-audio");

            Assert.IsFalse(rfcTag.PrivateUseContains("test-audio"));
        }
示例#30
0
		public string GetCompleteTag()
		{
			var rfcTag = new RFC5646Tag(Language, Script, Region, Variant, PrivateUse);
			return rfcTag.CompleteTag;
		}
示例#31
0
        public void Parse_HasLanguageAndRegionAndVariantAndMultiplePrivateUse_RFC5646TagHasExpectedFields()
        {
            var tag = RFC5646Tag.Parse("de-DE-bauddha-x-private-use");

            AssertTag(tag, "de", string.Empty, "DE", "bauddha", "x-private-use");
        }