public async Task HandleAsync_WithNonInternalUser_ThrowsSecurityException() { // Arrange var authorization = new AuthorizationBuilder().DenyInternalAreaAccess().Build(); var handler = new GetUkWeeeAtAatfsCsvHandler( authorization, A.Dummy <IGetUkWeeeAtAatfsCsvDataAccess>(), A.Dummy <CsvWriterFactory>()); var request = new GetUkWeeeAtAatfsCsv(A.Dummy <int>()); // Act Func <Task <FileInfo> > testCode = async() => await handler.HandleAsync(request); // Assert await Assert.ThrowsAsync <SecurityException>(testCode); }
public async Task HandleAsync_Always_GeneratesCorrectFileName() { // Arrange var authorization = AuthorizationBuilder.CreateUserWithAllRights(); var handler = new GetUkWeeeAtAatfsCsvHandler( authorization, A.Dummy <IGetUkWeeeAtAatfsCsvDataAccess>(), A.Dummy <CsvWriterFactory>()); var request = new GetUkWeeeAtAatfsCsv(2016); // Act SystemTime.Freeze(new DateTime(2016, 12, 31, 23, 59, 0)); var result = await handler.HandleAsync(request); SystemTime.Unfreeze(); // Assert Assert.Equal("2016_UK WEEE received at AATFs_31122016_2359.csv", result.FileName); }