Example #1
0
        public async Task HandleAsync_NoComplianceYear_ThrowsArgumentException()
        {
            const int complianceYear = 0;

            GetAatfAeDetailsCsv request = new GetAatfAeDetailsCsv(complianceYear, fixture.Create <ReportFacilityType>(), fixture.Create <Guid>(), fixture.Create <Guid>(), fixture.Create <Guid>(), fixture.Create <bool>());

            Func <Task> action = async() => await handler.HandleAsync(request);

            await Assert.ThrowsAsync <ArgumentException>(action);
        }
Example #2
0
        public async Task HandleAsync_NotInternalUser_ThrowsSecurityException()
        {
            IWeeeAuthorization authorization = new AuthorizationBuilder().DenyInternalAreaAccess().Build();

            GetAatfAeDetailsCsvHandler handler = new GetAatfAeDetailsCsvHandler(authorization, context, csvWriterFactory, commonDataAccess);
            GetAatfAeDetailsCsv        request = new GetAatfAeDetailsCsv(fixture.Create <int>(), fixture.Create <ReportFacilityType>(), fixture.Create <Guid>(), fixture.Create <Guid>(), fixture.Create <Guid>(), fixture.Create <bool>());

            Func <Task> action = async() => await handler.HandleAsync(request);

            await Assert.ThrowsAsync <SecurityException>(action);
        }