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;
 }
        public void ShouldExportClaimSet()
        {
            var testApplication = new Application
            {
                ApplicationName = $"Test Application {DateTime.Now:O}"
            };

            Save(testApplication);

            var testClaimSet1 = new ClaimSet {
                ClaimSetName = "TestClaimSet1", Application = testApplication
            };

            Save(testClaimSet1);

            var testClaimSet2 = new ClaimSet {
                ClaimSetName = "TestClaimSet2", Application = testApplication
            };

            Save(testClaimSet2);

            SetupParentResourceClaimsWithChildren(testClaimSet1, testApplication);

            SetupParentResourceClaimsWithChildren(testClaimSet2, testApplication);

            var getClaimSetById = new GetClaimSetByIdQuery(TestContext);

            var exportModel = new ClaimSetFileExportModel
            {
                Title     = "TestDownload",
                ClaimSets = new List <Management.ClaimSetEditor.ClaimSet>
                {
                    getClaimSetById.Execute(testClaimSet1.ClaimSetId),
                    getClaimSetById.Execute(testClaimSet2.ClaimSetId)
                },
                SelectedForExport = new List <int>
                {
                    testClaimSet1.ClaimSetId, testClaimSet2.ClaimSetId
                }
            };

            var getResourceByClaimSetIdQuery = new GetResourcesByClaimSetIdQuery(TestContext, GetMapper());

            var command      = new ClaimSetFileExportCommand(TestContext, getResourceByClaimSetIdQuery);
            var sharingModel = command.Execute(exportModel);

            var resourcesForClaimSet1 = getResourceByClaimSetIdQuery.AllResources(testClaimSet1.ClaimSetId).ToList();
            var resourcesForClaimSet2 = getResourceByClaimSetIdQuery.AllResources(testClaimSet2.ClaimSetId).ToList();

            sharingModel.Title.ShouldContain("TestDownload");
            var sharedClaimSets = sharingModel.Template.ClaimSets;

            sharedClaimSets.Length.ShouldBe(2);

            var sharedClaimSet1 = sharedClaimSets[0];

            var sharedClaimSet2 = sharedClaimSets[1];

            sharedClaimSet1.Name.ShouldBe(testClaimSet1.ClaimSetName);
            MatchResources(sharedClaimSet1.ResourceClaims, resourcesForClaimSet1);

            sharedClaimSet2.Name.ShouldBe(testClaimSet2.ClaimSetName);
            MatchResources(sharedClaimSet2.ResourceClaims, resourcesForClaimSet2);
        }