public async Task GetSubmissionHistoryResultHandler_RequestByExternalUser_ReturnSubmissionHistoryData()
        {
            // Arrange
            IGetSubmissionsHistoryResultsDataAccess dataAccess = CreateFakeDataAccess();
            IWeeeAuthorization authorization            = A.Fake <IWeeeAuthorization>();
            GetSubmissionsHistoryResultsHandler handler = new GetSubmissionsHistoryResultsHandler(authorization, dataAccess);
            GetSubmissionsHistoryResults        request = new GetSubmissionsHistoryResults(A.Dummy <Guid>(), A.Dummy <Guid>(), A.Dummy <int>());

            request.Ordering = SubmissionsHistoryOrderBy.ComplianceYearAscending;

            // Act
            SubmissionsHistorySearchResult results = await handler.HandleAsync(request);

            // Assert
            A.CallTo(() => authorization.EnsureInternalOrOrganisationAccess(A <Guid> ._)).MustHaveHappened();
            Assert.Equal(2, results.Data.Count);
            Assert.Equal(2, results.ResultCount);
        }
        private IGetSubmissionsHistoryResultsDataAccess CreateFakeDataAccess()
        {
            IGetSubmissionsHistoryResultsDataAccess dataAccess = A.Fake <IGetSubmissionsHistoryResultsDataAccess>();

            var results = new SubmissionsHistorySearchResult()
            {
                Data = new List <SubmissionsHistorySearchData>()
                {
                    new SubmissionsHistorySearchData(),
                    new SubmissionsHistorySearchData()
                },
                ResultCount = 2
            };

            A.CallTo(() => dataAccess.GetSubmissionsHistory(A <Guid> ._, A <int> ._, A <SubmissionsHistoryOrderBy> ._, A <bool> ._))
            .Returns(results);

            return(dataAccess);
        }
Ejemplo n.º 3
0
 public GetSubmissionsHistoryResultsHandler(IWeeeAuthorization authorization, IGetSubmissionsHistoryResultsDataAccess dataAccess)
 {
     this.authorization = authorization;
     this.dataAccess    = dataAccess;
 }