public void ShouldGetResourceClaims() { var testApplication = new Application { ApplicationName = "TestApplicationName" }; Save(testApplication); var testResourceClaims = SetupResourceClaims(testApplication); var testParentResource = testResourceClaims.Single(x => x.ResourceName == "TestParentResourceClaim1"); Transaction <SqlServerSecurityContext>(securityContext => { var query = new GetChildResourceClaimsForParentQuery(securityContext); var results = query.Execute(testParentResource.ResourceClaimId).ToArray(); var testChildResourceClaims = securityContext.ResourceClaims.Where(x => x.ParentResourceClaimId == testParentResource.ResourceClaimId); results.Length.ShouldBe(testChildResourceClaims.Count()); results.Select(x => x.Name).ShouldBe(testChildResourceClaims.Select(x => x.ResourceName), true); results.Select(x => x.Id).ShouldBe(testChildResourceClaims.Select(x => x.ResourceClaimId), true); results.All(x => x.Create == false).ShouldBe(true); results.All(x => x.Delete == false).ShouldBe(true); results.All(x => x.Update == false).ShouldBe(true); results.All(x => x.Read == false).ShouldBe(true); results.All(x => x.ParentId.Equals(testParentResource.ResourceClaimId)).ShouldBe(true); }); }
public ClaimSetsController(IGetClaimSetByIdQuery getClaimSetByIdQuery , IGetApplicationsByClaimSetIdQuery getApplicationsByClaimSetIdQuery , IGetResourcesByClaimSetIdQuery getResourcesByClaimSetIdQuery , IGetClaimSetsByApplicationNameQuery getClaimSetsByApplicationNameQuery , IGetAuthStrategiesByApplicationNameQuery getAuthStrategiesByApplicationNameQuery , ITabDisplayService tabDisplayService , CopyClaimSetCommand copyClaimSetCommand , AddClaimSetCommand addClaimSetCommand , EditClaimSetCommand editClaimSetCommand , GetResourceClaimsQuery getResourceClaimsQuery , GetChildResourceClaimsForParentQuery getChildResourceClaimsForParentQuery , DeleteClaimSetCommand deleteClaimSetCommand , EditResourceOnClaimSetCommand editResourceOnClaimSetCommand , DeleteResourceOnClaimSetCommand deleteResourceOnClaimSetCommand , ClaimSetFileExportCommand claimSetFileExportCommand , ClaimSetFileImportCommand claimSetFileImportCommand , OverrideDefaultAuthorizationStrategyCommand overrideDefaultAuthorizationStrategyCommand , ResetToDefaultAuthStrategyCommand resetToDefaultAuthStrategyCommand) { _getClaimSetByIdQuery = getClaimSetByIdQuery; _getApplicationsByClaimSetIdQuery = getApplicationsByClaimSetIdQuery; _getResourcesByClaimSetIdQuery = getResourcesByClaimSetIdQuery; _getClaimSetsByApplicationNameQuery = getClaimSetsByApplicationNameQuery; _getAuthStrategiesByApplicationNameQuery = getAuthStrategiesByApplicationNameQuery; _tabDisplayService = tabDisplayService; _copyClaimSetCommand = copyClaimSetCommand; _addClaimSetCommand = addClaimSetCommand; _editClaimSetCommand = editClaimSetCommand; _getClaimSetByIdQuery = getClaimSetByIdQuery; _getResourceClaimsQuery = getResourceClaimsQuery; _getChildResourceClaimsForParentQuery = getChildResourceClaimsForParentQuery; _deleteClaimSetCommand = deleteClaimSetCommand; _editResourceOnClaimSetCommand = editResourceOnClaimSetCommand; _deleteResourceOnClaimSetCommand = deleteResourceOnClaimSetCommand; _claimSetFileExportCommand = claimSetFileExportCommand; _claimSetFileImportCommand = claimSetFileImportCommand; _overrideDefaultAuthorizationStrategyCommand = overrideDefaultAuthorizationStrategyCommand; _resetToDefaultAuthStrategyCommand = resetToDefaultAuthStrategyCommand; }