예제 #1
0
        public void AddRemoveAuthorTest()
        {
            var writer = new EpubWriter();

            writer.AddAuthor("Foo Bar");
            var epub = WriteAndRead(writer);

            Assert.AreEqual(1, epub.Authors.Count);

            writer.AddAuthor("Zoo Gar");
            epub = WriteAndRead(writer);
            Assert.AreEqual(2, epub.Authors.Count);

            writer.RemoveAuthor("Foo Bar");
            epub = WriteAndRead(writer);
            Assert.AreEqual(1, epub.Authors.Count);
            Assert.AreEqual("Zoo Gar", epub.Authors[0]);

            writer.RemoveAuthor("Unexisting");
            epub = WriteAndRead(writer);
            Assert.AreEqual(1, epub.Authors.Count);

            writer.ClearAuthors();
            epub = WriteAndRead(writer);
            Assert.AreEqual(0, epub.Authors.Count);

            writer.RemoveAuthor("Unexisting");
            writer.ClearAuthors();
        }