Esempio n. 1
0
        public void AddChildrenComment__does_not_allow_to_add_duplicate()
        {
            var newComment = new Comment();
            var oldComment = new Comment();

            oldComment.AddChildrenComment(newComment);

            Exception ex = Assert.Throws <InvalidOperationException>(
                () => oldComment.AddChildrenComment(newComment)
                );

            Assert.Equal("Duplicated comment", ex.Message);
        }
Esempio n. 2
0
        public void AddChildrenComment__adding_new_comment_increments_collection()
        {
            var newComment = new Comment();
            var oldComment = new Comment();

            oldComment.AddChildrenComment(newComment);
            Assert.Equal(oldComment.Childrens.ToList().Count, 1);
        }
Esempio n. 3
0
        public void AddChildrenComment__does_not_allow_to_add_loop()
        {
            var newComment = new Comment();

            Exception ex = Assert.Throws <InvalidOperationException>(
                () => newComment.AddChildrenComment(newComment)
                );

            Assert.Equal("Looped comment", ex.Message);
        }