public async Task GetProducerPublicRegisterCSVHandler_ComplianceYear_ReturnsFileContent()
        {
            // Arrange
            var complianceYear = 2016;

            var authorization = new AuthorizationBuilder().AllowInternalAreaAccess().Build();
            var context = A.Fake<WeeeContext>();
            var csvWriterFactory = A.Fake<CsvWriterFactory>();

            var handler = new GetProducerPublicRegisterCSVHandler(authorization, context, csvWriterFactory);
            var request = new GetProducerPublicRegisterCSV(complianceYear);

            // Act
            CSVFileData data = await handler.HandleAsync(request);

            // Assert
            Assert.NotEmpty(data.FileContent);
        }
        public async Task GetProducerPublicRegisterCSVHandler_ComplianceYear_ReturnsFileContent()
        {
            // Arrange
            var complianceYear = 2016;

            var authorization    = new AuthorizationBuilder().AllowInternalAreaAccess().Build();
            var context          = A.Fake <WeeeContext>();
            var csvWriterFactory = A.Fake <CsvWriterFactory>();

            var handler = new GetProducerPublicRegisterCSVHandler(authorization, context, csvWriterFactory);
            var request = new GetProducerPublicRegisterCSV(complianceYear);

            // Act
            CSVFileData data = await handler.HandleAsync(request);

            // Assert
            Assert.NotEmpty(data.FileContent);
        }
        public async Task GetProducerPublicRegisterCSVHandler_NoComplianceYear_ThrowsArgumentException()
        {
            // Arrange
            var complianceYear = 0;

            var authorization = new AuthorizationBuilder().AllowInternalAreaAccess().Build();
            var context = A.Fake<WeeeContext>();
            var csvWriterFactory = A.Fake<CsvWriterFactory>();

            var handler = new GetProducerPublicRegisterCSVHandler(authorization, context, csvWriterFactory);
            var request = new GetProducerPublicRegisterCSV(complianceYear);

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

            // Assert
            await Assert.ThrowsAsync<ArgumentException>(action);
        }
        public async Task GetProducerPublicRegisterCSVHandler_NoComplianceYear_ThrowsArgumentException()
        {
            // Arrange
            var complianceYear = 0;

            var authorization    = new AuthorizationBuilder().AllowInternalAreaAccess().Build();
            var context          = A.Fake <WeeeContext>();
            var csvWriterFactory = A.Fake <CsvWriterFactory>();

            var handler = new GetProducerPublicRegisterCSVHandler(authorization, context, csvWriterFactory);
            var request = new GetProducerPublicRegisterCSV(complianceYear);

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

            // Assert
            await Assert.ThrowsAsync <ArgumentException>(action);
        }