コード例 #1
0
        public void ShouldDeleteReport()
        {
            const long reportId = 213;

            const long userId = 12342;

            var report = new Reports
            {
                Id = reportId
            };

            _reportRepository.Setup(_ => _.GetById(reportId)).Returns(report);

            _reportAuthorityValidator
            .Setup(_ => _.CanEdit(userId, report))
            .Returns(true);

            _userPrincipal
            .Setup(_ => _.Info)
            .Returns(new UserInfo
            {
                Id = userId
            });

            _target.Delete(reportId);

            _reportRepository.Verify(_ => _.Delete(report), Times.Once);

            _reportRepository.Verify(_ => _.Save(), Times.Once);
        }
コード例 #2
0
        /// <summary>
        ///   Processes the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        public void Process([NotNull] DeleteReportCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            _reportStorage.Delete(command.ReportId);
        }