AppendMedium() public method

Adds the medium newMedium to the end of the list. If the newMedium is already used, it is first removed.
INVALID_CHARACTER_ERR: If the medium contains characters that are invalid in the underlying style language. NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is readonly.
public AppendMedium ( string newMedium ) : void
newMedium string The new medium to add.
return void
Beispiel #1
0
        public void TestAppendMedium()
        {
            MediaList list = new MediaList();
            list.AppendMedium("screen");
            Assert.AreEqual(1, list.Length);
            Assert.AreEqual("screen", list.MediaText);
            Assert.AreEqual("screen", list[0]);

            list.AppendMedium("all");
            Assert.AreEqual(2, list.Length);
            Assert.AreEqual("screen,all", list.MediaText);
            Assert.AreEqual("screen", list[0]);
            Assert.AreEqual("all", list[1]);

            list.AppendMedium("screen");
            Assert.AreEqual(2, list.Length);
            Assert.AreEqual("all,screen", list.MediaText);
            Assert.AreEqual("all", list[0]);
            Assert.AreEqual("screen", list[1]);
        }