public void AnnotationOfMisssingAlternative()
        {
            MultiTextBase multiTextBase = new MultiTextBase();

            Assert.IsFalse(multiTextBase.GetAnnotationOfAlternativeIsStarred("zz"));
            Assert.IsFalse(multiTextBase.ContainsAlternative("zz"), "should not cause the creation of the alt");
        }
        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 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"));
        }
Beispiel #5
0
        private bool HasAllRequiredButMissingAtLeastOneWeWantToFillIn(MultiTextBase text)
        {
            foreach (var wsId in _writingSystemsWhichAreRequired)
            {
                if (!text.ContainsAlternative(wsId))
                {
                    return(false);
                }
            }

            foreach (var wsId in _writingSystemsWhichWeWantToFillIn)
            {
                if (!text.ContainsAlternative(wsId))
                {
                    return(true);
                }
            }
            return(false);
        }