예제 #1
0
        public void TestGetComments()
        {
            Controller.CommentController ctrl = new Controller.CommentController(new CommentMockup());
            Assert.ThrowsException <DoesNotExistException>(() => ctrl.GetComments(0));

            Assert.AreEqual(1, ctrl.GetComments(1).ToList().Count);
        }
예제 #2
0
        public void TestCreateComment()
        {
            Controller.CommentController ctrl = new Controller.CommentController(new CommentMockup());

            Assert.ThrowsException <DoesNotExistException>(() => ctrl.CreateComment(0, 0, "test"));
            Assert.ThrowsException <DoesNotExistException>(() => ctrl.CreateComment(0, 2, "test"));
            Assert.ThrowsException <DoesNotExistException>(() => ctrl.CreateComment(2, 0, "test"));
            Assert.ThrowsException <ArgumentException>(() => ctrl.CreateComment(2, 2, ""));

            try
            {
                ctrl.CreateComment(1, 1, "test");
            }
            catch (Exception)
            {
                Assert.Fail("Could not create comment");
            }
        }