Exemplo n.º 1
0
        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");
        }
Exemplo n.º 2
0
        public void ClearingAnnotationOfEmptyAlternativeRemovesTheAlternative()
        {
            MultiTextBase multiTextBase = new MultiTextBase();

            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true);
            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false);
            Assert.IsFalse(multiTextBase.ContainsAlternative("zz"));
        }
Exemplo n.º 3
0
        public void ClearingAnnotationOfNonEmptyAlternative()
        {
            MultiTextBase multiTextBase = new MultiTextBase();

            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", true);
            multiTextBase["zz"] = "hello";
            multiTextBase.SetAnnotationOfAlternativeIsStarred("zz", false);
            Assert.IsTrue(multiTextBase.ContainsAlternative("zz"));
        }
Exemplo n.º 4
0
        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"));
        }
Exemplo n.º 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);
        }