示例#1
0
        public void TestApplicationClient()
        {
            LanguageString title = new LanguageString
            {
                { "nb", "testapplikasjon" },
                { "en", "Test application" },
            };

            Application appMetadata = applicationClient.CreateApplication("test/sailor", title);

            Assert.Equal("test/sailor", appMetadata.Id);

            Application appMetadata2 = applicationClient.GetApplication("test/sailor");

            Assert.Equal(appMetadata.Id, appMetadata2.Id);
        }
示例#2
0
        private Application CreateTestApplication()
        {
            Application testApplication = new Application()
            {
                Id        = testAppId,
                VersionId = "1.2.0",
                Org       = "testing",
                Title     = new LanguageString
                {
                    { "nb", "test multipart instantiation" },
                },
                ValidFrom    = new DateTime(2019, 07, 01),
                ValidTo      = new DateTime(2020, 06, 30),
                ElementTypes = new List <ElementType>()
            };

            testApplication.ElementTypes.Add(new ElementType()
            {
                Id = "default",
                AllowedContentType = new List <string>()
                {
                    "text/xml", "application/xml"
                },
            });

            testApplication.ElementTypes.Add(new ElementType()
            {
                Id = "picture",
                AllowedContentType = new List <string>()
                {
                    "image/png", "image/jpg"
                }
            });

            Application app = new Application();

            try
            {
                app = applicationClient.GetApplication(testApplication.Id);

                if (app != null)
                {
                    app = applicationClient.UpdateApplication(testApplication);
                }
            }
            catch
            {
                app = applicationClient.CreateApplication(testApplication);
            }

            return(app);
        }
        private void CreateTestApplications()
        {
            List <Application> apps = testdata.GetApps();

            foreach (Application app in apps)
            {
                try
                {
                    appClient.CreateApplication(app);
                }
                catch (Exception)
                {
                    // do nothing.
                }
            }
        }
示例#4
0
        private Application CreateTestApplication(string appId)
        {
            ApplicationClient appClient = new ApplicationClient(client);

            try
            {
                Application existingApp = appClient.GetApplication(appId);
                return(existingApp);
            }
            catch (Exception)
            {
                // do nothing.
            }

            return(appClient.CreateApplication(appId, null));
        }
        private static Application CreateTestApplication(string testAppId, HttpClient client)
        {
            ApplicationClient appClient = new ApplicationClient(client);

            try
            {
                Application existingApp = appClient.GetApplication(testAppId);
                return(existingApp);
            }
            catch (Exception)
            {
                // do nothing.
            }

            LanguageString title = new LanguageString
            {
                { "nb", "Testapplikasjon" },
                { "en", "Test application" }
            };

            return(appClient.CreateApplication(testAppId, title));
        }