Example #1
0
func TestBookListAll(t *testing.T) {

	b := readhacker.Book{}

	for _, v := range b.ListAll() {
		fmt.Println(v.String())
	}
}
Example #2
0
func TestBookGetByBookId(t *testing.T) {
	b := readhacker.Book{}
	book := b.GetByBookId(1)

	if book == nil {
		t.Error("book is nil")
	} else {
		fmt.Printf(book.BookName)
	}
}
Example #3
0
func TestBookGetAllChapter(t *testing.T) {
	b := readhacker.Book{}
	chapters := b.GetAllChapter(1)

	if len(chapters) == 0 {
		t.Error("chapter not found")
	} else {
		for _, chapter := range chapters {
			fmt.Print(chapter.ChapterName + "\n")
		}
	}
}