コード例 #1
0
        public void GetAllForComment_ReturnsValue_IfNotNull()
        {
            var report = new List <CommentReport>();

            report.Add(new CommentReport()
            {
                Id        = 1,
                CommentId = 2,
                Email     = "*****@*****.**",
                Reported  = true
            });
            report.Add(new CommentReport()
            {
                Id        = 2,
                CommentId = 2,
                Email     = "*****@*****.**",
                Reported  = true
            });
            report.Add(new CommentReport()
            {
                Id        = 3,
                CommentId = 1,
                Email     = "*****@*****.**",
                Reported  = true
            });

            _commentReportRepositoryMock.Setup(a => a.GetAll()).Returns(report.ToList());

            var result = _service.GetAllForComment(2);

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(result);
        }
コード例 #2
0
ファイル: CommentService.cs プロジェクト: ligaluse/MoneyBlog
        public void DeleteWithReports(int id)
        {
            var reportToDelete = _commentReportService.GetAllForComment(id);

            foreach (var report in reportToDelete)
            {
                _commentReportService.DeleteReport(report.Id);
            }
            _commentRepository.Delete(id);
        }