Пример #1
0
 public IQueryable <Advice> GetAdvicesAccessibleToCurrentUser()
 {
     return(OrganizationalUserContext.IsGlobalAdmin()
         ? AdviceRepository.AsQueryable()
         : OrganizationalUserContext
            .OrganizationIds
            .Select(GetAdvicesForOrg)
            .Aggregate <IQueryable <Advice>, IQueryable <Advice> >
            (
                null,
                (acc, next) => acc == null ? next : acc.Concat(next)
            ));
 }
        public void IsGlobalAdmin_Returns_Has_Global_Admin_In_Any_Organization(bool expectedResult)
        {
            //Arrange
            SetupSut(new Dictionary <int, IEnumerable <OrganizationRole> >
            {
                { _municipalityOrganizationId, new [] { OrganizationRole.ContractModuleAdmin } },
                { _otherOrgTypeOrganizationId, new [] { expectedResult?OrganizationRole.GlobalAdmin: OrganizationRole.ReportModuleAdmin } }
            });

            //Act
            var result = _sut.IsGlobalAdmin();

            //Assert
            Assert.Equal(expectedResult, result);
        }