예제 #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");
        }