private static SimpleMetadata CreateMetadataWithTopicCategory(string topicCategory) { var metadata = SimpleMetadata.CreateDataset(); metadata.TopicCategory = topicCategory; return(metadata); }
internal string CreateMetadata(MetadataCreateViewModel model, string username) { SimpleMetadata metadata = null; if (model.Type.Equals("service")) { metadata = SimpleMetadata.CreateService(); } else { metadata = SimpleMetadata.CreateDataset(); if (model.Type.Equals("software")) { metadata.HierarchyLevel = "software"; } else if (model.Type.Equals("series")) { metadata.HierarchyLevel = "series"; } } metadata.Title = model.Title; metadata.Abstract = "..."; metadata.ContactMetadata = new SimpleContact { Name = model.MetadataContactName, Email = model.MetadataContactEmail, Organization = model.MetadataContactOrganization, Role = "pointOfContact" }; metadata.ContactPublisher = new SimpleContact { Name = model.MetadataContactName, Email = model.MetadataContactEmail, Organization = model.MetadataContactOrganization, Role = "publisher" }; metadata.ContactOwner = new SimpleContact { Name = model.MetadataContactName, Email = model.MetadataContactEmail, Organization = model.MetadataContactOrganization, Role = "owner" }; DateTime now = DateTime.Now; metadata.DateCreated = now; metadata.DatePublished = now; metadata.DateUpdated = now; SetDefaultValuesOnMetadata(metadata); _geoNorge.MetadataInsert(metadata.GetMetadata(), CreateAdditionalHeadersWithUsername(username)); return(metadata.Uuid); }
private static MD_Metadata_Type CreateDummyMetadata() { SimpleMetadata simpleMetadata = SimpleMetadata.CreateDataset(); simpleMetadata.ContactMetadata = new SimpleContact { Name = "John Smith", Email = "*****@*****.**", Organization = "Kartverket" }; return(simpleMetadata.GetMetadata()); }
private static SimpleMetadata CreateMetadataWithKeyword(string keyword, string thesaurus = null) { var metadata = SimpleMetadata.CreateDataset(); var keywords = new List <SimpleKeyword>(); keywords.Add(new SimpleKeyword { Keyword = keyword, Thesaurus = thesaurus }); metadata.Keywords = keywords; return(metadata); }
private static SimpleMetadata createMetadataWithInspireKeyword(string inspireKeyword) { var metadata = SimpleMetadata.CreateDataset(); var keywords = new List <SimpleKeyword>(); keywords.Add(new SimpleKeyword { Thesaurus = SimpleKeyword.THESAURUS_GEMET_INSPIRE_V1, Keyword = inspireKeyword }); metadata.Keywords = keywords; return(metadata); }
public void ShouldReturnMetadataFromGeoNorge() { var dummyMetadata = SimpleMetadata.CreateDataset().GetMetadata(); var geoNorgeMock = new Mock <IGeoNorge>(); geoNorgeMock.Setup(m => m.GetRecordByUuid(Uuid)).Returns(dummyMetadata); var geonorgeUrlResolverMock = new Mock <IGeonorgeUrlResolver>(); var organizationServiceMock = new Mock <IOrganizationService>(); var searchServiceMock = new Mock <ISearchService>(); searchServiceMock.Setup(x => x.GetMetadata(Uuid)).Returns(new Metadatakatalog.Models.MetadataIndexDoc()); var themeResolverMock = new Mock <ThemeResolver>(); var searchServiceDirectoryServiceMock = new Mock <IServiceDirectoryService>(); var metadataService = new MetadataService(geoNorgeMock.Object, new GeoNetworkUtil("http://example.com/"), geonorgeUrlResolverMock.Object, organizationServiceMock.Object, searchServiceMock.Object, searchServiceDirectoryServiceMock.Object); var metadata = metadataService.GetMetadataViewModelByUuid(Uuid); metadata.Should().NotBeNull(); }
public void ShouldResolveToAnnenWhenNoKeywordOrTopicCategoryWithMappingExists() { ResolveTheme(SimpleMetadata.CreateDataset()).Should().Be(ThemeResolver.DokAnnen); }