public void MakeEBookTest() { Publisher ps = new Publisher(new PublishrConfig(author)); Chapter[] cs = new Chapter[3]; MochajoeEncryptBook ebk = ps.MjEncryptBook; Assert.IsNotNull(ebk); Assert.IsNotNull(ebk.AuthorName); Assert.AreEqual(author, ebk.AuthorName); string no; for (int i = 0; i < cs.Length; i++) { no = i.ToString(); cs[i] = new Chapter { Number = no, Text = "text," + no }; } string json = ps.MakeEncryptBook(cs); Assert.IsNotNull(json); ebk = JsonConvert.DeserializeObject <MochajoeEncryptBook>(json); Assert.IsNotNull(ebk); Assert.IsNotNull(ebk.AuthorName); Assert.AreEqual(author, ebk.AuthorName); Assert.IsNotNull(ebk.EChapters); }
public void MochajoeEncryptBookTest() { string buffer = System.IO.File.ReadAllText("MochajoeEncryptBook.json"); MochajoeEncryptBook mjeb = JsonConvert.DeserializeObject <MochajoeEncryptBook>(buffer); Assert.IsNotNull(mjeb); Assert.IsNotNull(mjeb.AuthorName); Assert.IsNotNull(mjeb.Title); Assert.AreEqual("三语沫", mjeb.AuthorName); Assert.IsTrue(mjeb.EChapters.Count > 0); Assert.IsNotNull(mjeb.EChapters[0].Etext); Assert.IsNotNull(mjeb.EChapters[0].Esign); Assert.IsNotNull(mjeb.EChapters[1].Ekey); }