コード例 #1
0
        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>();
        }
コード例 #2
0
        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>();
        }
コード例 #3
0
        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);
        }