Exemplo n.º 1
0
        public async void UserIsUnableToAccessOrganisation_ShouldNotGetManageableOrganisationUsers()
        {
            var organisationId = Guid.NewGuid();

            A.CallTo(() => weeeAuthorization.EnsureOrganisationAccess(organisationId))
            .Throws <SecurityException>();

            await Assert.ThrowsAsync <SecurityException>(
                () =>
                GetManageableOrganisationUsersHandler()
                .HandleAsync(new GetManageableOrganisationUsers(organisationId)));

            A.CallTo(() => dataAccess.GetManageableUsers(A <Guid> ._))
            .MustNotHaveHappened();
        }
Exemplo n.º 2
0
        public async Task <List <OrganisationUserData> > HandleAsync(GetManageableOrganisationUsers query)
        {
            authorization.EnsureOrganisationAccess(query.OrganisationId);

            var organisationUsers = await dataAccess.GetManageableUsers(query.OrganisationId);

            return(organisationUsers.Select(item => organisationUserMap.Map(item)).ToList());
        }