Ejemplo n.º 1
0
        public async Task <IActionResult> FetchAllReports([FromQuery] FetchAllReportsRequest request)
        {
            var response = await mediator.Send(request);

            Log.Information($"User #{HttpContext.GetCurrentUserId()} fetched reports");

            return(this.CreateResponse(response));
        }
        public void Handle_NoPermissionForUser_ThrowNoPermissionsException()
        {
            var request = new FetchAllReportsRequest
            {
                CategoryType = ReportCategoryType.Account
            };

            Assert.That(() => fetchAllReportsQuery.Handle(request, It.IsAny <CancellationToken>()),
                        Throws.TypeOf <NoPermissionsException>());
        }
        public async Task Handle_WhenCalled_ReturnFetchAllReportsPaginationResponse(ReportCategoryType type)
        {
            var request = new FetchAllReportsRequest
            {
                CategoryType = type
            };

            var result = await fetchAllReportsQuery.Handle(request, It.IsAny <CancellationToken>());

            Assert.That(result, Is.TypeOf <FetchAllReportsResponse>());
            Assert.That(result.Reports, Is.EqualTo(reportsDto));
            Assert.That(result, Is.Not.Null);
        }