Exemplo n.º 1
0
        public void 插入顯示文章()
        {
            ForumDB db = new ForumDB();

            db.insertArticle("teamD", "測試新文章標題", "測試摘要", "測試文章內容", "測試文章內圖片");//articleID 0

            db.insertComment("這篇文章很讚", "cyZeng", 0);
            db.insertComment("這篇文章很無聊", "Kevin", 0);
            List <Comment> match = db.getComment(0);

            Assert.That("這篇文章很讚", Is.EqualTo(match[0].getContent()));
            Assert.That("這篇文章很無聊", Is.EqualTo(match[1].getContent()));


            db.insertArticle("teamD", "測試新文章標題2", "測試摘要", "測試文章內容2", "測試文章內圖片");//articleID 1
            db.insertComment("Cool", "Lee", 1);
            List <Comment> match2 = db.getComment(1);

            Assert.That("Cool", Is.EqualTo(match2[0].getContent()));
        }
        public void 新增评论_Action()
        {
            ForumDB db     = new ForumDB();
            Action  action = new Action();
            Article art    = new Article();

            db.insertArticle("teamD", "測試標題", "測試摘要", "測試內容", "picture1");
            db.insertComment("測試內容", "teamD", 0);
            List <Comment> match = db.getComment(0);

            Assert.That("測試內容", Is.EqualTo(match[0].getContent()));
            Assert.That("測試內容", Is.EqualTo(action.addComment(db, db.accounts[0], art, "測試內容")));
        }