private static Identification ParseIdentification(XElement xElement)
        {
            var identification = new Identification();

            if (xElement == null)
            {
                return(identification);
            }
            var identificationElement =
                NinXmlParser.GetChildElements(xElement, "Identifikasjon", TillatAntall.AkkuratEn);

            var identificationLocalIds =
                NinXmlParser.GetChildElements(identificationElement[0], "lokalId", TillatAntall.AkkuratEn);

            identification.LocalId = new Guid(identificationLocalIds[0].Value);

            var identificationNamespaces =
                NinXmlParser.GetChildElements(identificationElement[0], "navnerom", TillatAntall.AkkuratEn);

            identification.NameSpace = identificationNamespaces[0].Value;

            var identificationVersionIds = NinXmlParser.GetChildElements(identificationElement[0], "versjonId",
                                                                         TillatAntall.MaksimaltEn);

            if (identificationVersionIds.Count == 1)
            {
                identification.VersionId = identificationVersionIds[0].Value;
            }

            return(identification);
        }
        public void StoreDataDeliveryTest()
        {
            var identification = new Identification
            {
                LocalId   = Guid.NewGuid(),
                NameSpace = "DataAccessTest",
                VersionId = "1.0"
            };

            var natureArea = new NatureArea
            {
                UniqueId = identification,
                Version  = "2.0",
                Nivå     = NatureLevel.Natursystem,
                //Area = SqlGeometry.STPolyFromText(new SqlChars("POLYGON ((5 5, 10 5, 10 10, 5 5))"), 0),
                //Area = SqlGeometry.STPolyFromText(new SqlChars("POLYGON ((-11 55, -10 35, -5.5 36, -1 36, 1 38, 5 38, 11 38, 14 36, 26 33, 29 36, 26 39, 29 46, 39 47, 40 49, 27 56, 27 60, 25 60, 20 58, 21 56, 19 55, 11 55, 10 57, 7 57, 8 54, 3 53, -2 60, -8 58, -11 55))"), 0),
                Area         = "POLYGON ((-11 55, -10 35, -5.5 36, -1 36, 1 38, 5 38, 11 38, 14 36, 26 33, 29 36, 26 39, 29 46, 39 47, 40 49, 27 56, 27 60, 25 60, 20 58, 21 56, 19 55, 11 55, 10 57, 7 57, 8 54, 3 53, -2 60, -8 58, -11 55))",
                AreaEpsgCode = 25832,
                Surveyer     = new Contact
                {
                    Company       = "Norconsult informasjonssystemer AS",
                    ContactPerson = "Magne Tøndel",
                    Email         = "*****@*****.**",
                    Phone         = "+4748164614",
                    Homesite      = "www.nois.no"
                },
                Surveyed    = new DateTime(2015, 9, 18, 19, 00, 00),
                Description = "Description"
            };

            natureArea.Documents.Add(new Document
            {
                Title       = "NatureAreaDocumentOne",
                Description = "Description",
                Author      = new Contact
                {
                    Company       = "Norconsult informasjonssystemer AS",
                    ContactPerson = "Magne Tøndel",
                    Email         = "*****@*****.**",
                    Phone         = "+4748164614",
                    Homesite      = "www.nois.no"
                },
                FileName = "C:\\Document\\TestNatureAreaOne"
            });
            natureArea.Documents.Add(new Document
            {
                Title       = "NatureAreaDocumentTwo",
                Description = "Description",
                Author      = new Contact
                {
                    Company       = "Norconsult informasjonssystemer AS",
                    ContactPerson = "Magne Tøndel",
                    Email         = "*****@*****.**",
                    Phone         = "+4748164614",
                    Homesite      = "www.nois.no"
                },
                FileName = "C:\\Document\\TestNatureAreaTwo"
            });

            var metadata = new Metadata
            {
                UniqueId           = identification,
                Program            = "Program",
                ProjectName        = "ProjectName",
                ProjectDescription = "ProjectDescription",

                Quality = new Quality
                {
                    MeasuringMethod       = "Terrengmålt: Uspesifisert måleinstrument",
                    Accuracy              = 1,
                    Visibility            = "Fullt ut synlig/gjenfinnbar i terrenget",
                    MeasuringMethodHeight = "Terrengmålt: Totalstasjon",
                    AccuracyHeight        = 2,
                    MaxDeviation          = 3,
                },
            };

            metadata.NatureAreas.Add(natureArea);

            metadata.Documents.Add(
                new Document
            {
                Title       = "NatureAreaDocument",
                Description = "Description",
                FileName    = "C:\\Document\\TestMetadata"
            }
                );

            var dataDelivery = new Dataleveranse
            {
                Name         = "DataDeliveryTest",
                DeliveryDate = DateTime.Now,
                Metadata     = metadata,
                Created      = new DateTime(2015, 9, 17, 12, 30, 30),
                Publisering  = Status.Importert
            };

            var id = dbInterface.LagreDataleveranse(dataDelivery);

            Assert.IsNotEmpty(id);
        }