public void Constructor_LanguageIsEmptyAndPrivateUseIsSet_CompleteTagConsistsOnlyOfPrivateUse() { var tag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "audio"); Assert.AreEqual("x-audio", tag.CompleteTag); }
public void Language_SetWithCasedButValidLanguageTag_SetsLanguage() { var tag = new RFC5646Tag("EN", String.Empty, String.Empty, String.Empty, String.Empty); Assert.AreEqual("EN", tag.Language); }
public void AddToPrivateUse_StringToAddContainsNonAlphaNumericCharacter_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("_audio")); }
public void Region_SetWhileLanguageSubtagIsEmpty_Throws() { var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "test"); Assert.Throws <ValidationException>(() => rfcTag.Region = "US"); }
public void Variant_SetWithInvalidVariant_Throws() { var tag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); Assert.Throws <ValidationException>(() => tag.Variant = "bogus"); }
public void Constructor_LanguageSubtagIsQaa_IsValid() { var rfcTag = new RFC5646Tag("qaa", String.Empty, String.Empty, String.Empty, String.Empty); Assert.AreEqual("qaa", rfcTag.Language); }
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")); }
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")); }
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")); }
public void AddToPrivateUse_PrivateUseAlreadyContainsStringToAddInDifferentCase_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "AUDIO"); Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("audio")); }
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")); }
public void RFC5646Tag_EmptyConstructor_HasDefaultLanguage() { var tag = new RFC5646Tag(); AssertTag(tag, "qaa", string.Empty, string.Empty, string.Empty, string.Empty); }
public void Parse_HasLanguageAndRegion_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("en-US"); AssertTag(tag, "en", string.Empty, "US", string.Empty, string.Empty); }
public void Parse_HasLanguageAndMultipleVariants_RFC5646TagHasExpectedFields() { var tag = RFC5646Tag.Parse("en-alalc97-aluku"); AssertTag(tag, "en", string.Empty, string.Empty, "alalc97-aluku", string.Empty); }
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")); }
public void VariantContainsPart_PartIsContainedInVariant_ReturnsTrue() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "1901", String.Empty); Assert.IsTrue(rfcTag.VariantContains("1901")); }
public void AddToVariant_VariantAlreadyContainsStringToAddInDifferentCase_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "BisKe", String.Empty); Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("biske")); }
public void Region_SetWithInvalidRegionTag_Throws() { var tag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); Assert.Throws <ValidationException>(() => tag.Region = "bogus"); }
public void AddToVariant_StringToAddBeginsWithx_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "biske", String.Empty); Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("x-bauddha")); }
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"); }
public void AddToVariant_StringToAddIsNotValidVariant_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); Assert.Throws <ValidationException>(() => rfcTag.AddToVariant("bogus")); }
public void Language_SetToEmptyWhenVariantIsNotEmpty_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, "1901", String.Empty); Assert.Throws <ValidationException>(() => rfcTag.Language = String.Empty); }
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")); }
public void Script_SetWhileLanguageSubtagIsEmpty_Throws() { var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "test"); Assert.Throws <ValidationException>(() => rfcTag.Script = "Zxxx"); }
public void PrivateUseContainsPart_PartIsNotContainedInPrivateUse_ReturnsFalse() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); Assert.IsFalse(rfcTag.PrivateUseContains("audio")); }
public void Variant_SetWhileLanguageSubtagIsEmpty_Throws() { var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "test"); Assert.Throws <ValidationException>(() => rfcTag.Variant = "1901"); }
public void PrivateUseContainsPart_PartIsContainedInPrivateUseAndpartDoesNotHavePrependedx_ReturnsTrue() { var rfcTag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "audio"); Assert.IsTrue(rfcTag.PrivateUseContains("audio")); }
public void Constructor_LanguageIsEmptyAndPrivateUseIsSet_SetsPrivateUse() { var tag = new RFC5646Tag(String.Empty, String.Empty, String.Empty, String.Empty, "audio"); Assert.AreEqual("x-audio", tag.PrivateUse); }
public void PrivateUseContainsPart_PartConsistsOfMultiplePartsAndAllPartsAreContainedInPrivateUse_ReturnsFalse() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "test-audio"); Assert.IsFalse(rfcTag.PrivateUseContains("test-audio")); }
public string GetCompleteTag() { var rfcTag = new RFC5646Tag(Language, Script, Region, Variant, PrivateUse); return rfcTag.CompleteTag; }
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"); }