public async Task HandleAsync_NoExternalAccess_ThrowsSecurityException() { var authorization = new AuthorizationBuilder().DenyExternalAreaAccess().Build(); handler = new SubmitReturnHandler(authorization, userContext, genericDataAccess, weeeContext, fetchAatfDataAccess); Func <Task> action = async() => await handler.HandleAsync(A.Dummy <SubmitReturn>()); await action.Should().ThrowAsync <SecurityException>(); }
public async Task HandleAsync_NoOrganisationAccess_ThrowsSecurityException() { var authorization = new AuthorizationBuilder().DenyOrganisationAccess().Build(); A.CallTo(() => genericDataAccess.GetById <Return>(A <Guid> ._)).Returns(A.Fake <Return>()); handler = new SubmitReturnHandler(authorization, userContext, genericDataAccess, weeeContext, fetchAatfDataAccess); Func <Task> action = async() => await handler.HandleAsync(A.Dummy <SubmitReturn>()); await action.Should().ThrowAsync <SecurityException>(); }
public SubmitReturnHandlerTests() { userContext = A.Fake <IUserContext>(); genericDataAccess = A.Fake <IGenericDataAccess>(); weeeContext = A.Fake <WeeeContext>(); fetchAatfDataAccess = A.Fake <IFetchAatfDataAccess>(); fixture = new Fixture(); handler = new SubmitReturnHandler(new AuthorizationBuilder() .AllowExternalAreaAccess() .AllowOrganisationAccess().Build(), userContext, genericDataAccess, weeeContext, fetchAatfDataAccess); }