/// <summary>
        /// Creates a fake data access that returns 5 organisation users and 5 competent authority users.
        /// </summary>
        /// <returns></returns>
        private IFindMatchingUsersDataAccess CreateFakeDataAccess(UserFilter filter)
        {
            IFindMatchingUsersDataAccess dataAccess = A.Fake <IFindMatchingUsersDataAccess>();

            List <UserSearchData> organisationUsers = new List <UserSearchData>()
            {
                new UserSearchData()
                {
                    Id = "User 1", FirstName = "XGF", LastName = "RYH", Role = "N/A"
                },
                new UserSearchData()
                {
                    Id = "User 2", FirstName = "RHY", LastName = "EGJ", Role = "N/A"
                },
                new UserSearchData()
                {
                    Id = "User 3", FirstName = "GDR", LastName = "FDV", Role = "N/A"
                },
                new UserSearchData()
                {
                    Id = "User 4", FirstName = "JUK", LastName = "EEE", Role = "N/A"
                },
                new UserSearchData()
                {
                    Id = "User 5", FirstName = "HBN", LastName = "UTL", Role = "N/A"
                },
            };

            A.CallTo(() => dataAccess.GetOrganisationUsers(filter)).Returns(organisationUsers.ToArray());

            List <UserSearchData> competentAuthorityUsers = new List <UserSearchData>()
            {
                new UserSearchData()
                {
                    Id = "User 6", FirstName = "AGF", LastName = "GUI", Role = "Standard"
                },
                new UserSearchData()
                {
                    Id = "User 7", FirstName = "HTF", LastName = "HBG", Role = "Administrator"
                },
                new UserSearchData()
                {
                    Id = "User 8", FirstName = "VFE", LastName = "RDE", Role = "Standard"
                },
                new UserSearchData()
                {
                    Id = "User 9", FirstName = "TED", LastName = "SWR", Role = "Administrator"
                },
                new UserSearchData()
                {
                    Id = "User 10", FirstName = "YGR", LastName = "FTW", Role = "Standard"
                },
            };

            A.CallTo(() => dataAccess.GetCompetentAuthorityUsers(filter)).Returns(competentAuthorityUsers.ToArray());

            return(dataAccess);
        }
        public async void FindMatchingUsersHandler_WithNonInternalUser_ThrowSecurityException(AuthorizationBuilder.UserType userType)
        {
            // Arrage
            IFindMatchingUsersDataAccess dataAccess = A.Fake <IFindMatchingUsersDataAccess>();
            var filter = fixture.Create <UserFilter>();

            A.CallTo(() => dataAccess.GetOrganisationUsers(filter)).Returns(new UserSearchData[5]);
            A.CallTo(() => dataAccess.GetCompetentAuthorityUsers(filter)).Returns(new UserSearchData[5]);

            IWeeeAuthorization authorization = AuthorizationBuilder.CreateFromUserType(userType);

            FindMatchingUsersHandler handler = new FindMatchingUsersHandler(authorization, dataAccess);

            FindMatchingUsers request = new FindMatchingUsers(1, 1, FindMatchingUsers.OrderBy.FullNameAscending, filter);

            // Act
            Func <Task <UserSearchDataResult> > action = () => handler.HandleAsync(request);

            // Assert
            await Assert.ThrowsAsync <SecurityException>(action);
        }