public bookChapter GetChapterById(string chapterId) { var aChapter = new bookChapter(); foreach (bookChapter t in this.aBook.chapters) { if (t.id == chapterId) { aChapter = t; } } return(aChapter); }
public UnitTestBookRepository() { bookRepository = new BookRepository(); aBook = new book(); var serializer = new XmlSerializer(typeof(book)); var stream = new FileStream("C:/Users/andresc/Desktop/Fairy-tales/fairytales/BookWriterTool/BookWriterTool/Content/Resources/Test/bookNoMetadata2.xml", FileMode.Open); aBook = serializer.Deserialize(stream) as book; stream.Close(); chapter1 = aBook.chapters[0]; aPage = new bookChapterPage(); bookChapterPage[] apage = aBook.chapters[0].pages; bookChapter[] achapter = aBook.chapters; numberOfChapters = achapter.Length; numberOfPages = apage.Length; }
public void TestAddChapter() { chapter2 = new bookChapter(); chapter2.id = "chapter2"; aBook.chapters.SetValue(chapter1, 1); }