public void ClearingAnnotationOfEmptyAlternativeRemovesTheAlternative() { MultiTextBase multiTextBase = new MultiTextBase(); multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true); multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false); Assert.IsFalse(multiTextBase.ContainsAlternative("zz")); }
public void ClearingAnnotationOfNonEmptyAlternative() { MultiTextBase multiTextBase = new MultiTextBase(); multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true); multiTextBase["zz"] = "hello"; multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false); Assert.IsTrue(multiTextBase.ContainsAlternative("zz")); }
public void SetAnnotation() { MultiTextBase multiTextBase = new MultiTextBase(); multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true); Assert.AreEqual(String.Empty, multiTextBase.GetExactAlternative("zz")); Assert.IsTrue(multiTextBase.GetAnnotationOfAlternativeIsStarred("zz")); multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false); Assert.IsFalse(multiTextBase.GetAnnotationOfAlternativeIsStarred("zz")); }
public void HasFormWithSameContent_OneEmpty_False() { MultiTextBase x = new MultiTextBase(); MultiTextBase y = new MultiTextBase(); y["ws"] = "test"; y.SetAnnotationOfAlternativeIsStarred("ws", true); Assert.IsFalse(x.HasFormWithSameContent(y)); Assert.IsFalse(y.HasFormWithSameContent(x)); }
public void EmptyingTextOfFlaggedAlternativeDoesNotDeleteIfFlagged() { // REVIEW: not clear really what behavior we want here, since user deletes via clearing text MultiTextBase multiTextBase = new MultiTextBase(); multiTextBase["zz"] = "hello"; multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true); multiTextBase["zz"] = ""; Assert.IsTrue(multiTextBase.ContainsAlternative("zz")); }
private static void AddAnnotationsToMultiText(LiftMultiText forms, MultiTextBase text) { foreach (Annotation annotation in forms.Annotations) { if (annotation.Name == "flag") { text.SetAnnotationOfAlternativeIsStarred(annotation.LanguageHint, int.Parse(annotation.Value) > 0); } else { //log dropped } } }