public void CanDelete_UserIsNotAuthorOfTheComment_ReturnsFalse()
        {
            // Arrange
            int userId = 1;
            Comment comment = new Comment { UserId = userId + 1 };

            ICommentService target = new CommentService(new Mock<IUnitOfWork>().Object, this._commentValidationMock.Object,
            this._serviceSettings);

            // Act
            bool result = target.CanDelete(userId, comment);

            //Assert
            Assert.IsFalse(result);
        }
        public void CanDelete_UserIdIsLessOrEqualToZero_ThrowsArgumentOutOfRangeException()
        {
            // Arrange
            Comment comment = new Comment { CommentId = 1 };

            ICommentService target = new CommentService(new Mock<IUnitOfWork>().Object, this._commentValidationMock.Object,
            this._serviceSettings);

            // Act and Assert
            Assert.Throws<ArgumentOutOfRangeException>(() => target.CanDelete(-1, comment));
            Assert.Throws<ArgumentOutOfRangeException>(() => target.CanDelete(0, comment));
        }
        public void CanDelete_PermittedPeriodForDeletingExpired_ReturnsFalse()
        {
            // Arrange
            Comment comment = new Comment
            { UserId = 1, Date = DateTime.Now.AddSeconds(-(this._serviceSettings.PermittedPeriodForDeleting + 1)) };

            // Arrange - create target
            ICommentService target = new CommentService(new Mock<IUnitOfWork>().Object, this._commentValidationMock.Object,
            this._serviceSettings);

            // Act
            bool result = target.CanDelete(comment.UserId, comment);

            //Assert
            Assert.IsFalse(result);
        }
        public void CanDelete_UserCanDeleteTheComment_ReturnsTrue()
        {
            // Arrange
            Comment comment = new Comment { UserId = 1, Date = DateTime.Now };

            // Arrange - create target
            ICommentService target = new CommentService(new Mock<IUnitOfWork>().Object, this._commentValidationMock.Object,
            this._serviceSettings);

            // Act
            bool result = target.CanDelete(comment.UserId, comment);

            //Assert
            Assert.IsTrue(result);
        }
        public void CanDelete_CommentIsNull_ThrowsArgumentNullException()
        {
            // Arrange
            int userId = 1;

            ICommentService target = new CommentService(new Mock<IUnitOfWork>().Object, this._commentValidationMock.Object,
            this._serviceSettings);

            // Act and Assert
            Assert.Throws<ArgumentNullException>(() => target.CanDelete(userId, null));
        }