public void AddToPrivateUse_PrivateUseIsEmpty_PrivateUseEqualsStringToAdd() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); rfcTag.AddToPrivateUse("audio"); Assert.AreEqual("x-audio", rfcTag.PrivateUse); }
public void AddToPrivateUse_TagBeginningWithx_Set() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); rfcTag.AddToPrivateUse("xtest"); Assert.AreEqual("x-xtest", rfcTag.PrivateUse); }
public void AddToPrivateUse_StringToAddEndsWithDash_StringIsAdded() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "test"); rfcTag.AddToPrivateUse("audio-"); Assert.AreEqual("x-test-audio", rfcTag.PrivateUse); }
public void AddToPrivateUse_StringToAddConsistsOfMultipleParts_StringToAddIsAppendedToPrivateUseWithDashDelimiter() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "test-audios"); rfcTag.AddToPrivateUse("audio-variant2"); Assert.AreEqual("x-test-audios-audio-variant2", rfcTag.PrivateUse); }
public void AddToPrivateUse_TagEndingInx_Set() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); rfcTag.AddToPrivateUse("testx"); Assert.AreEqual("x-testx", rfcTag.PrivateUse); }
public void AddToPrivateUse_StringToAddIsSubStringOfStringAlreadyContainedInPrivateUse_StringToAddIsAppendedToPrivateUseWithDashDelimiter() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "audios-test"); rfcTag.AddToPrivateUse("audio"); Assert.AreEqual("x-audios-test-audio", rfcTag.PrivateUse); }
public void AddToPrivateUse_PrivateUseIsNotEmpty_StringToAddIsAppendedToPrivateUseWithDashDelimiter() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "test"); rfcTag.AddToPrivateUse("audio"); Assert.AreEqual("x-test-audio", rfcTag.PrivateUse); }
public void AddToPrivateUse_StringToAddWithx_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "test"); Assert.Throws <ValidationException>( () => rfcTag.AddToPrivateUse("bbb-x-audio") ); }
private static string UniqueTagForDuplicate(string rfcTag, IEnumerable <string> uniqueRfcTags) { RFC5646Tag tag = RFC5646Tag.Parse(rfcTag); string originalPrivateUse = tag.PrivateUse; int duplicateNumber = 0; do { duplicateNumber++; tag.PrivateUse = originalPrivateUse; tag.AddToPrivateUse(String.Format("dupl{0}", duplicateNumber)); } while (uniqueRfcTags.Any(s => s.Equals(tag.CompleteTag, StringComparison.OrdinalIgnoreCase))); return(tag.CompleteTag); }
public void AddToPrivateUse_StringToAddContainsUnderScoreAfterx_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("x_audio")); }
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 AddToPrivateUse_PrivateUseAlreadyContainsStringToAddInDifferentCase_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, "AUDIO"); Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("audio")); }
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_StringToAddContainsIllegalCharacters_Throws() { var rfcTag = new RFC5646Tag("en", String.Empty, String.Empty, String.Empty, String.Empty); Assert.Throws <ValidationException>(() => rfcTag.AddToPrivateUse("x-audio_test")); }