public async Task GetDataReturnSubmissionsHistoryResultHandler_RetrievesDataWithSpecifiedSort()
        {
            // Arrange
            var dataAccess = A.Fake<IGetSubmissionsHistoryResultsDataAccess>();
            var authorization = A.Fake<IWeeeAuthorization>();
            var handler = new GetSubmissionsHistoryResultsHandler(authorization, dataAccess);

            var request = new GetSubmissionsHistoryResults(A.Dummy<Guid>(), A.Dummy<Guid>(), A.Dummy<int>());
            request.Ordering = SubmissionsHistoryOrderBy.SubmissionDateAscending;

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

            // Assert
            A.CallTo(() => dataAccess.GetSubmissionsHistory(A<Guid>._, A<int>._, SubmissionsHistoryOrderBy.SubmissionDateAscending, A<bool>._))
                .MustHaveHappened();
        }
        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);
        }
        public async Task GetDataReturnSubmissionsHistoryResultHandler_RetrievesDataWithSpecifiedSort()
        {
            // Arrange
            var dataAccess    = A.Fake <IGetSubmissionsHistoryResultsDataAccess>();
            var authorization = A.Fake <IWeeeAuthorization>();
            var handler       = new GetSubmissionsHistoryResultsHandler(authorization, dataAccess);

            var request = new GetSubmissionsHistoryResults(A.Dummy <Guid>(), A.Dummy <Guid>(), A.Dummy <int>());

            request.Ordering = SubmissionsHistoryOrderBy.SubmissionDateAscending;

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

            // Assert
            A.CallTo(() => dataAccess.GetSubmissionsHistory(A <Guid> ._, A <int> ._, SubmissionsHistoryOrderBy.SubmissionDateAscending, A <bool> ._))
            .MustHaveHappened();
        }
        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);
        }