コード例 #1
0
        public async Task HandleAsync_WithNonInternalAccess_ThrowsSecurityException(AuthorizationBuilder.UserType userType)
        {
            IWeeeAuthorization            authorization = AuthorizationBuilder.CreateFromUserType(userType);
            UserManager <ApplicationUser> userManager   = A.Fake <UserManager <ApplicationUser> >();

            CheckApprovalNumberIsUniqueHandler handler = new CheckApprovalNumberIsUniqueHandler(authorization, dataAccess);

            Func <Task> action = async() => await handler.HandleAsync(A.Dummy <CheckApprovalNumberIsUnique>());

            await Assert.ThrowsAsync <SecurityException>(action);
        }
コード例 #2
0
        public async Task HandleAsync_WithNonInternalAdminRole_ThrowsSecurityException()
        {
            IWeeeAuthorization authorization = new AuthorizationBuilder()
                                               .AllowInternalAreaAccess()
                                               .DenyRole(Roles.InternalAdmin)
                                               .Build();

            UserManager <ApplicationUser> userManager = A.Fake <UserManager <ApplicationUser> >();

            CheckApprovalNumberIsUniqueHandler handler = new CheckApprovalNumberIsUniqueHandler(authorization, this.dataAccess);

            Func <Task> action = async() => await handler.HandleAsync(A.Dummy <CheckApprovalNumberIsUnique>());

            await Assert.ThrowsAsync <SecurityException>(action);
        }
コード例 #3
0
        public CheckApprovalNumberIsUniqueHandlerTests()
        {
            dataAccess = A.Fake <IFetchAatfDataAccess>();

            handler = new CheckApprovalNumberIsUniqueHandler(AuthorizationBuilder.CreateUserWithAllRights(), dataAccess);
        }