Exemplo n.º 1
0
        private void TestXmlOutput(MemoryStream xmlStream, IEntityInfo expected, bool readMetadata)
        {
            if (xmlStream.CanSeek)
            {
                xmlStream.Seek(0, SeekOrigin.Begin);
            }
            else
            {
                xmlStream = new MemoryStream(xmlStream.ToArray());
            }

            OsmXmlReader reader = new OsmXmlReader(xmlStream, new OsmXmlReaderSettings()
            {
                ReadMetadata = readMetadata
            });
            IEntityInfo read = reader.Read();

            switch (expected.EntityType)
            {
            case EntityType.Node: this.CompareNodes(expected as NodeInfo, read as NodeInfo); break;

            case EntityType.Way: this.CompareWays(expected as WayInfo, read as WayInfo); break;

            case EntityType.Relation: this.CompareRelation(expected as RelationInfo, read as RelationInfo); break;
            }
        }
Exemplo n.º 2
0
 public void Constructor_StreamSettings_SetsSettingsAndMakesItReadOnly()
 {
     OsmXmlReaderSettings settings = new OsmXmlReaderSettings() { ReadMetadata = false };
     using (OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_simple_node), settings)) {
         Assert.Same(settings, target.Settings);
         Assert.True(settings.IsReadOnly);
     }
 }
Exemplo n.º 3
0
        public void Read_ThrowsExceptionIfWayNDHasNotRef()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-way-nd-without-ref.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 4
0
        public void Read_ThrowsExceptionIfWayNDHasNotRef()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_way_nd_without_ref), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 5
0
        public void Read_ThrowsExceptionIfNodeHasNotLon()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-node-without-lon.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 6
0
 public void Constructor_StringSettings_SetsSettingsAndMakesItReadOnly()
 {
     string path = "../../src/Tests.SpatialLite.Osm/Data/Xml/osm-real-file.osm";
     OsmXmlReaderSettings settings = new OsmXmlReaderSettings() { ReadMetadata = false };
     using (OsmXmlReader target = new OsmXmlReader(path, settings)) {
         Assert.Same(settings, target.Settings);
         Assert.True(settings.IsReadOnly);
     }
 }
Exemplo n.º 7
0
        public void Read_ThrowsExceptionIfRelationMemberHasNotType()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_member_without_type), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 8
0
        public void Read_DoesNotThrowExceptionIPieceOffMetadataIsMissingAndStrictModeIsFalse()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-node-missing-timestamp.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = true, StrictMode = false
            });

            target.Read();
        }
Exemplo n.º 9
0
        public void Read_ThrowsExceptionIPieceOffMetadataIsMissingAndStrictModeIsTrue()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-node-missing-timestamp.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = true, StrictMode = true
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 10
0
        public void Read_DoesNotThrowExceptionIPieceOffMetadataIsMissingAndStrictModeIsFalse()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_missing_timestamp), new OsmXmlReaderSettings()
            {
                ReadMetadata = true, StrictMode = false
            });

            Assert.DoesNotThrow(() => target.Read());
        }
Exemplo n.º 11
0
        public void Read_ThrowsExceptionIfNodeHasNotLon()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_without_lon), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 12
0
        public void Read_ThrowsExceptionIPieceOffMetadataIsMissingAndStrictModeIsTrue()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_missing_timestamp), new OsmXmlReaderSettings()
            {
                ReadMetadata = true, StrictMode = true
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 13
0
        public void Load_ThrowsExceptionIfAllRelationReferencesAreNotResolvedAtTheEndOfLoadingAndIgnoreMissingIsFalse()
        {
            IOsmReader reader = new OsmXmlReader(TestDataReader.OpenOsmDB("osm-relation-invalid-ref.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = true
            });

            Assert.Throws <ArgumentException>(() => OsmGeometryDatabase.Load(reader, false));
        }
        public void Load_ThrowsExceptionIfAllRelationReferencesAreNotResolvedAtTheEndOfLoadingAndIgnoreMissingIsFalse()
        {
            IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_relation_invalid_ref), new OsmXmlReaderSettings()
            {
                ReadMetadata = true
            });

            Assert.Throws <ArgumentException>(() => OsmGeometryDatabase.Load(reader, false));
        }
Exemplo n.º 15
0
        public void Read_ThrowsExceptionIfRelationMemberHasNotType()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-relation-member-without-type.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });

            Assert.Throws <XmlException>(() => target.Read());
        }
Exemplo n.º 16
0
        public void Read_ReadsRelationWithAllProperties()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_all_properties), new OsmXmlReaderSettings()
            {
                ReadMetadata = true
            });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationProperties, readRelation);
        }
Exemplo n.º 17
0
        public void Read_ReadsRelationWithTagsAndUnknownElement()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_with_tags_and_unknown_element), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationTags, readRelation);
        }
Exemplo n.º 18
0
        public void Read_ReadsRelationWithRelationMember()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_relation), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationRelation, readRelation);
        }
Exemplo n.º 19
0
        public void Read_ReadsWayWithAllAttributes()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_way_all_properties), new OsmXmlReaderSettings()
            {
                ReadMetadata = true
            });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayProperties, readWay);
        }
Exemplo n.º 20
0
        public void Read_ReadsWayWithUnknownElement()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_way_with_tags_and_unknown_element), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayTags, readWay);
        }
        public void XmlOsmReaderReadsFilesCreatedByOsmosis()
        {
            string xmlFile = Path.GetFullPath("TestFiles\\xmlreader-osmosis-compatibility-test-osmosis-real-file.osm");
            string osmosisArguments = string.Format("--read-pbf file={0} --write-xml file={1}", Path.GetFullPath(TestFilePath), xmlFile);
            this.CallOsmosis(osmosisArguments);

            using (OsmXmlReader reader = new OsmXmlReader(xmlFile, new OsmXmlReaderSettings() { ReadMetadata = true, StrictMode = false })) {
                this.TestReader(reader);
            }
        }
Exemplo n.º 22
0
        public void Read_SkipsUnknownElements()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-unknown-inner-element.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            IEntityInfo result = target.Read();

            Assert.NotNull(result as NodeInfo);
        }
Exemplo n.º 23
0
        public void Read_ReadsSimpleWay()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_simple_way), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_way, readWay);
        }
Exemplo n.º 24
0
        public void Read_ReadsWayWithoutNodes()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-way-without-nodes.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayWithoutNodes, readWay);
        }
Exemplo n.º 25
0
        public void Read_ReadsNodeWithTags()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-node-with-tags.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            NodeInfo readNode = target.Read() as NodeInfo;

            this.CompareNodes(_nodeTags, readNode);
        }
Exemplo n.º 26
0
        public void Read_ReadsNodeWithAllAttributes()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-node-all-properties.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = true
            });
            NodeInfo readNode = target.Read() as NodeInfo;

            this.CompareNodes(_nodeProperties, readNode);
        }
Exemplo n.º 27
0
        public void Read_ReadsSimpleNode()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-simple-node.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            NodeInfo readNode = target.Read() as NodeInfo;

            this.CompareNodes(_node, readNode);
        }
Exemplo n.º 28
0
        public void Read_ReadsRelationWithTagsAndUnknownElement()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-relation-with-tags-and-unknown-element.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationTags, readRelation);
        }
Exemplo n.º 29
0
        public void Read_ReadsRelationWithAllProperties()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-relation-all-properties.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = true
            });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationProperties, readRelation);
        }
Exemplo n.º 30
0
        public void Read_ReadsWayWithAllAttributes()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-way-all-properties.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = true
            });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayProperties, readWay);
        }
Exemplo n.º 31
0
        public void Read_ReadsRelationWithRelationMember()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-relation-relation.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationRelation, readRelation);
        }
Exemplo n.º 32
0
        public void Read_ReadsWayWithUnknownElement()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-way-with-tags-and-unknown-element.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayTags, readWay);
        }
Exemplo n.º 33
0
        public void Read_ReadsSimpleWay()
        {
            OsmXmlReader target = new OsmXmlReader(TestDataReader.OpenXml("osm-simple-way.osm"), new OsmXmlReaderSettings()
            {
                ReadMetadata = false
            });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_way, readWay);
        }
Exemplo n.º 34
0
        public void Read_ReadsNodeWithUnknownElement()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_with_tag_and_unknown_element), new OsmXmlReaderSettings() { ReadMetadata = false });
            NodeInfo readNode = target.Read() as NodeInfo;

            this.CompareNodes(_node, readNode);

            // nothing more left to read in the file
            Assert.Null(target.Read());
        }
Exemplo n.º 35
0
        public void Read_ReadsNodeWithTags()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_with_tags), new OsmXmlReaderSettings() { ReadMetadata = false });
            NodeInfo readNode = target.Read() as NodeInfo;

            this.CompareNodes(_nodeTags, readNode);
        }
Exemplo n.º 36
0
        public void Read_ReadsNodeWithAllAttributes()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_all_properties), new OsmXmlReaderSettings() { ReadMetadata = true });
            NodeInfo readNode = target.Read() as NodeInfo;

            this.CompareNodes(_nodeProperties, readNode);
        }
        public void Load_IOsmReader_LoadsWay()
        {
            IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_way), new OsmXmlReaderSettings() { ReadMetadata = true });
            OsmEntityInfoDatabase target = OsmEntityInfoDatabase.Load(reader);

            Assert.Equal(3, target.Nodes.Count);
            Assert.True(target.Nodes.Contains(1));
            Assert.True(target.Nodes.Contains(2));
            Assert.True(target.Nodes.Contains(3));

            Assert.Equal(1, target.Ways.Count);
            Assert.True(target.Ways.Contains(10));
        }
Exemplo n.º 38
0
        public void Read_ThrowsExceptionIfTagHasNotValue()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_tag_without_value), new OsmXmlReaderSettings() { ReadMetadata = false });

            Assert.Throws<XmlException>(() => target.Read());
        }
        public void Load_CanLoadRelationsWithReferenceToRelationsNotYetCreated()
        {
            IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_relation_ref_other_relation), new OsmXmlReaderSettings() { ReadMetadata = true });
            OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true);

            Assert.Equal(2, target.Relations.Count);
            Assert.True(target.Relations.Contains(100));
            Assert.True(target.Relations.Contains(101));

            Assert.Equal(101, target.Relations[100].Geometries[0].Member.ID);
        }
Exemplo n.º 40
0
        public void Read_ReadsRelationWithWayMember()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_way), new OsmXmlReaderSettings() { ReadMetadata = false });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationWay, readRelation);
        }
Exemplo n.º 41
0
        public void Read_ReadsSimpleWay()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_simple_way), new OsmXmlReaderSettings() { ReadMetadata = false });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_way, readWay);
        }
Exemplo n.º 42
0
        private void TestXmlOutput(MemoryStream xmlStream, IEntityInfo expected, bool readMetadata)
        {
            if (xmlStream.CanSeek) {
                xmlStream.Seek(0, SeekOrigin.Begin);
            }
            else {
                xmlStream = new MemoryStream(xmlStream.GetBuffer());
            }

            OsmXmlReader reader = new OsmXmlReader(xmlStream, new OsmXmlReaderSettings() { ReadMetadata = readMetadata });
            IEntityInfo read = reader.Read();

            switch (expected.EntityType) {
                case EntityType.Node: this.CompareNodes(expected as NodeInfo, read as NodeInfo); break;
                case EntityType.Way: this.CompareWays(expected as WayInfo, read as WayInfo); break;
                case EntityType.Relation: this.CompareRelation(expected as RelationInfo, read as RelationInfo); break;
            }
        }
Exemplo n.º 43
0
        public void Read_ReadsRelationWithAllProperties()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_all_properties), new OsmXmlReaderSettings() { ReadMetadata = true });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationProperties, readRelation);
        }
Exemplo n.º 44
0
        public void Read_ReadsWayWithoutNodes()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_way_without_nodes), new OsmXmlReaderSettings() { ReadMetadata = false });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayWithoutNodes, readWay);
        }
Exemplo n.º 45
0
        public void Read_ReadsRelationWithTagsAndUnknownElement()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_with_tags_and_unknown_element), new OsmXmlReaderSettings() { ReadMetadata = false });
            RelationInfo readRelation = target.Read() as RelationInfo;

            this.CompareRelation(_relationTags, readRelation);
        }
Exemplo n.º 46
0
        public void Read_SkipsUnknownElements()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_unknown_inner_element), new OsmXmlReaderSettings() { ReadMetadata = false });
            IEntityInfo result = target.Read();

            Assert.NotNull(result as NodeInfo);
        }
Exemplo n.º 47
0
        public void Read_ReadsSimpleNode()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_simple_node), new OsmXmlReaderSettings() { ReadMetadata = false });
            NodeInfo readNode = target.Read() as NodeInfo;

            this.CompareNodes(_node, readNode);
        }
Exemplo n.º 48
0
 public void Read_ThrowsExceptionIPieceOffMetadataIsMissingAndStrictModeIsTrue()
 {
     OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_missing_timestamp), new OsmXmlReaderSettings() { ReadMetadata = true, StrictMode = true });
     Assert.Throws<XmlException>(() => target.Read());
 }
Exemplo n.º 49
0
        public void Read_ReadsWayWithAllAttributes()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_way_all_properties), new OsmXmlReaderSettings() { ReadMetadata = true });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayProperties, readWay);
        }
        public void Load_LoadsRelation()
        {
            IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_relation), new OsmXmlReaderSettings() { ReadMetadata = true });
            OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true);

            Assert.Equal(1, target.Nodes.Count);
            Assert.True(target.Nodes.Contains(1));

            Assert.Equal(1, target.Relations.Count);
            Assert.True(target.Relations.Contains(100));
        }
Exemplo n.º 51
0
        public void Read_ReadsWayWithUnknownElement()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_way_with_tags_and_unknown_element), new OsmXmlReaderSettings() { ReadMetadata = false });
            WayInfo readWay = target.Read() as WayInfo;

            this.CompareWays(_wayTags, readWay);
        }
Exemplo n.º 52
0
        public void Dispose_ClosesOutputStreamIfWritingToStream()
        {
            MemoryStream stream = new MemoryStream(XmlTestData.osm_real_file);

            OsmXmlReader target = new OsmXmlReader(stream, new OsmXmlReaderSettings() { ReadMetadata = false });
            target.Dispose();

            Assert.False(stream.CanRead);
        }
Exemplo n.º 53
0
        public void Read_ThrowsExceptionIfRelationMemberHasNotType()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_relation_member_without_type), new OsmXmlReaderSettings() { ReadMetadata = false });

            Assert.Throws<XmlException>(() => target.Read());
        }
Exemplo n.º 54
0
 public void Read_DoesNotThrowExceptionIPieceOffMetadataIsMissingAndStrictModeIsFalse()
 {
     OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_node_missing_timestamp), new OsmXmlReaderSettings() { ReadMetadata = true, StrictMode = false });
     Assert.DoesNotThrow(() => target.Read());
 }
Exemplo n.º 55
0
        public void Read_ThrowsExceptionIfWayNDHasNotRef()
        {
            OsmXmlReader target = new OsmXmlReader(new MemoryStream(XmlTestData.osm_way_nd_without_ref), new OsmXmlReaderSettings() { ReadMetadata = false });

            Assert.Throws<XmlException>(() => target.Read());
        }
        public void Load_IOsmReader_LoadedRealFile()
        {
            OsmXmlReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_real_file), new OsmXmlReaderSettings() { ReadMetadata = true });
            OsmEntityInfoDatabase target = OsmEntityInfoDatabase.Load(reader);

            Assert.Equal(6688, target.Nodes.Count);
            Assert.Equal(740, target.Ways.Count);
            Assert.Equal(75, target.Relations.Count);
        }
        public void Load_DoesNotThrowExceptionIfIgnoreMissingIsTrueAndWaysNodeIsMissing()
        {
            IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_way_invalid_ref), new OsmXmlReaderSettings() { ReadMetadata = true });
            OsmGeometryDatabase target = null;
            Assert.DoesNotThrow(() => target = OsmGeometryDatabase.Load(reader, true));

            Assert.Equal(2, target.Nodes.Count);
            Assert.Equal(0, target.Ways.Count);
        }
 public void Load_ThrowsExceptionIfAllRelationReferencesAreNotResolvedAtTheEndOfLoadingAndIgnoreMissingIsFalse()
 {
     IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_relation_invalid_ref), new OsmXmlReaderSettings() { ReadMetadata = true });
     Assert.Throws<ArgumentException>(() => OsmGeometryDatabase.Load(reader, false));
 }
Exemplo n.º 59
0
        public void Dispose_ClosesOutputStreamIfWritingToFiles()
        {
            string filename = "../../src/Tests.SpatialLite.Osm/Data/Xml/osm-real-file.osm";

            OsmXmlReader target = new OsmXmlReader(filename, new OsmXmlReaderSettings() { ReadMetadata = false });
            target.Dispose();

            FileStream testStream = null;
            Assert.DoesNotThrow(() => testStream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite));
            testStream.Dispose();
        }
Exemplo n.º 60
0
        static void TestXmlReaderSpeedWithoutMetadata()
        {
            int entitiesRead = 0;

            IEntityInfo info = null;
            using (OsmXmlReader reader = new OsmXmlReader("TestFiles\\test-file.osm", new OsmXmlReaderSettings() { ReadMetadata = false })) {
                while ((info = reader.Read()) != null) {
                    entitiesRead++;
                }
            }
        }