public GetAatfByIdExternalHandlerTests() { this.authorization = A.Fake <IWeeeAuthorization>(); this.dataAccess = A.Fake <IFetchAatfDataAccess>(); this.mapper = A.Fake <IMap <Aatf, AatfData> >(); this.handler = new GetAatfByIdExternalHandler(authorization, mapper, dataAccess); }
public async Task HandleAsync_NoOrganisationAccess_ThrowsSecurityException() { var authorization = new AuthorizationBuilder().DenyOrganisationAccess().Build(); handler = new GetAatfByIdExternalHandler(authorization, A.Dummy <IMap <Aatf, AatfData> >(), this.dataAccess); var message = new GetAatfByIdExternal(Guid.NewGuid()); var aatf = A.Fake <Aatf>(); A.CallTo(() => this.dataAccess.FetchById(message.AatfId)).Returns(aatf); Func <Task> action = () => this.handler.HandleAsync(message); await action.Should().ThrowAsync <SecurityException>(); }