Esempio n. 1
0
        public async Task <IActionResult> TogglePrivacyReport(TogglePrivacyReportRequest request)
        {
            var response = await mediator.Send(request);

            Log.Information(
                $"User #{HttpContext.GetCurrentUserId()} changed report #{request.ReportId} privacy to: {(response.IsPrivate ? "PRIVATE" : "NOT PRIVATE")}");

            return(this.CreateResponse(response));
        }
        public void SetUp()
        {
            report  = new Report();
            request = new TogglePrivacyReportRequest();
            var togglePrivacyReportResult = new TogglePrivacyReportResult(true, true);

            reportMananger      = new Mock <IReportManager>();
            reportValidationHub = new Mock <IReportValidationHub>();

            reportMananger.Setup(rm => rm.TogglePrivacyReport(It.IsAny <Report>()))
            .ReturnsAsync(togglePrivacyReportResult);
            reportValidationHub.Setup(rv =>
                                      rv.ValidateAndReturnReport(It.IsAny <string>(), It.IsAny <ReportPermission[]>())).ReturnsAsync(report);

            togglePrivacyReportCommand =
                new TogglePrivacyReportCommand(reportMananger.Object, reportValidationHub.Object);
        }