public async Task GetUkEeeDataCsvHandler_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 GetUkEeeDataCsvHandler(authorization, context, csvWriterFactory); var request = new GetUkEeeDataCsv(complianceYear); // Act CSVFileData data = await handler.HandleAsync(request); // Assert Assert.NotEmpty(data.FileContent); }
public async Task GetUkEeeDataCsvHandler_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 GetUkEeeDataCsvHandler(authorization, context, csvWriterFactory); var request = new GetUkEeeDataCsv(complianceYear); // Act CSVFileData data = await handler.HandleAsync(request); // Assert Assert.NotEmpty(data.FileContent); }
public async Task GetUkEeeDataCsvHandler_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 GetUkEeeDataCsvHandler(authorization, context, csvWriterFactory); var request = new GetUkEeeDataCsv(complianceYear); // Act Func <Task> action = async() => await handler.HandleAsync(request); // Assert await Assert.ThrowsAsync <ArgumentException>(action); }
public async Task GetUkEeeDataCsvHandler_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 GetUkEeeDataCsvHandler(authorization, context, csvWriterFactory); var request = new GetUkEeeDataCsv(complianceYear); // Act Func<Task> action = async () => await handler.HandleAsync(request); // Assert await Assert.ThrowsAsync<ArgumentException>(action); }