public void ShouldNotExportIfTitleEmpty()
        {
            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);

            var getClaimSetById = new GetClaimSetByIdQuery(TestContext);

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

            var validator         = new ClaimSetFileExportModelValidator();
            var validationResults = validator.Validate(exportModel);

            validationResults.IsValid.ShouldBe(false);
            validationResults.Errors.Select(x => x.ErrorMessage).ShouldContain("'Title' must not be empty.");
        }
        public void ShouldNotExportIfNoSelectedClaimSet()
        {
            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);

            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>()
            };

            var validator         = new ClaimSetFileExportModelValidator();
            var validationResults = validator.Validate(exportModel);

            validationResults.IsValid.ShouldBe(false);
            validationResults.Errors.Select(x => x.ErrorMessage).ShouldContain("You must select at least one claimset to proceed.");
        }