Exemplo n.º 1
0
        public void TestGetThreadsByCategory_ByCategoryID()
        {
            ForumSqlDAL        forumSqlDal        = new ForumSqlDAL();
            List <ThreadModel> threadByCategoryID = forumSqlDal.GetThreadsByCategory(categoryID);

            Assert.IsNotNull(threadByCategoryID);
            Assert.AreEqual(1, threadByCategoryID.Count);
        }
Exemplo n.º 2
0
        public void TestGetAllPostsByThreadID()
        {
            ForumSqlDAL      forumSqlDal      = new ForumSqlDAL();
            List <PostModel> threadByThreadID = forumSqlDal.GetAllPosts(threadId);

            Assert.IsNotNull(threadByThreadID);
            Assert.AreEqual(1, threadByThreadID.Count);
        }
Exemplo n.º 3
0
        public void TestGetAllCategories()
        {
            ForumSqlDAL            dal   = new ForumSqlDAL();
            List <CategoriesModel> model = new List <CategoriesModel>();

            model = dal.GetAllCategories();


            Assert.AreEqual(3, model[2].CategoryID);
            Assert.AreEqual("Fan Fiction", model[2].CategoryName);
        }
Exemplo n.º 4
0
        public void TestGetThreadByThreadID()
        {
            ForumSqlDAL forumSqlDal = new ForumSqlDAL();
            ThreadModel thread      = new ThreadModel();

            thread = forumSqlDal.GetThreadByThreadID(threadId);

            Assert.IsNotNull(thread);
            Assert.AreEqual(threadId, thread.ThreadID);
            Assert.AreEqual(1, thread.CategoryID);
            Assert.AreEqual("The awesome threadName", thread.ThreadName);
            Assert.AreEqual("12/7/2016 12:00:00 AM", thread.ThreadDate.ToString());
        }
Exemplo n.º 5
0
        public void TestSubmitThread()
        {
            ForumSqlDAL dal   = new ForumSqlDAL();
            ThreadModel model = new ThreadModel();

            model.UserID     = userId;
            model.CategoryID = 2;
            model.ThreadName = "The awesome threadName";

            bool isSubmitted = dal.SubmitThread(model);

            Assert.IsTrue(isSubmitted);
        }
Exemplo n.º 6
0
        public void TestSubmitPost()
        {
            ForumSqlDAL          dal     = new ForumSqlDAL();
            PostResultsViewModel model   = new PostResultsViewModel();
            PostModel            newPost = new PostModel();

            model.NewPost            = newPost;
            model.NewPost.ThreadID   = threadId;
            model.NewPost.UserID     = userId;
            model.NewPost.ThreadName = "The awesome threadName";
            model.NewPost.PostBody   = "This is the postBody";

            bool isSubmitted = dal.SubmitPost(model);

            Assert.IsTrue(isSubmitted);
        }