示例#1
0
        private async static Task UpdateApplicationMetadata(AltinnAppGitRepository altinnAppGitRepository, string schemaName, string typeName)
        {
            Application application = await altinnAppGitRepository.GetApplicationMetadata();

            UpdateApplicationWithAppLogicModel(application, schemaName, "Altinn.App.Models." + typeName);

            await altinnAppGitRepository.UpdateApplicationMetadata(application);
        }
示例#2
0
        private static async Task DeleteDatatypeFromApplicationMetadata(AltinnAppGitRepository altinnAppGitRepository, string id)
        {
            var applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata();

            if (applicationMetadata.DataTypes != null)
            {
                DataType removeForm = applicationMetadata.DataTypes.Find(m => m.Id == id);
                applicationMetadata.DataTypes.Remove(removeForm);
            }

            await altinnAppGitRepository.UpdateApplicationMetadata(applicationMetadata);
        }
示例#3
0
        public async Task GetApplicationMetadata_FileExists_ShouldHaveCorrectValues()
        {
            var org        = "ttd";
            var repository = "hvem-er-hvem";
            var developer  = "testUser";

            string repositoriesRootDirectory = TestDataHelper.GetTestDataRepositoriesRootDirectory();
            string repositoryDirectory       = TestDataHelper.GetTestDataRepositoryDirectory(org, repository, developer);
            var    altinnAppGitRepository    = new AltinnAppGitRepository(org, repository, developer, repositoriesRootDirectory, repositoryDirectory);

            var applicationMetadata = await altinnAppGitRepository.GetApplicationMetadata();

            applicationMetadata.Id.Should().Be("yabbin/hvem-er-hvem");
            applicationMetadata.Org.Should().Be("yabbin");
            applicationMetadata.Title.Should().ContainValues("Hvem er hvem?", "who-is-who");
            applicationMetadata.Title.Should().ContainKeys("nb", "en");

            applicationMetadata.DataTypes.Should().HaveCount(2);
            applicationMetadata.DataTypes.First(d => d.Id == "ref-data-as-pdf").AllowedContentTypes.First().Should().Be("application/pdf");

            DataType mainDataType = applicationMetadata.DataTypes.First(d => d.Id == "Kursdomene_HvemErHvem_M_2021-04-08_5742_34627_SERES");

            mainDataType.AllowedContentTypes.First().Should().Be("application/xml");
            mainDataType.AppLogic.ClassRef.Should().Be("Altinn.App.Models.HvemErHvem_M");
            mainDataType.AppLogic.AutoCreate.Should().BeTrue();
            mainDataType.MinCount.Should().Be(1);
            mainDataType.MaxCount.Should().Be(1);
            mainDataType.TaskId.Should().Be("Task_1");

            applicationMetadata.PartyTypesAllowed.Person.Should().BeFalse();
            applicationMetadata.PartyTypesAllowed.Organisation.Should().BeFalse();
            applicationMetadata.PartyTypesAllowed.SubUnit.Should().BeFalse();
            applicationMetadata.PartyTypesAllowed.BankruptcyEstate.Should().BeFalse();

            var dataField = applicationMetadata.DataFields.First(d => d.Id == "GeekType");

            dataField.Path.Should().Be("InnrapporterteData.geekType");
            dataField.DataTypeId.Should().Be("Kursdomene_HvemErHvem_M_2021-04-08_5742_34627_SERES");

            applicationMetadata.AutoDeleteOnProcessEnd.Should().BeFalse();
            applicationMetadata.Created.Should().BeSameDateAs(DateTime.Parse("2021-04-08T17:42:09.0883842Z"));
            applicationMetadata.CreatedBy.Should().Be("Ronny");
            applicationMetadata.LastChanged.Should().BeSameDateAs(DateTime.Parse("2021-04-08T17:42:09.08847Z"));
            applicationMetadata.LastChangedBy.Should().Be("Ronny");
        }