Exemple #1
0
        public void Load_LoadsGpxEntitiesFromFile()
        {
            string path = "../../../Data/Gpx/gpx-real-file.gpx";

            var target = GpxDocument.Load(path);

            Assert.Equal(3, target.Waypoints.Count);
            Assert.Equal(2, target.Routes.Count);
            Assert.Single(target.Tracks);
        }
Exemple #2
0
        public void Load_IGpxReader_LoadsEntitiesFromReader()
        {
            using (var reader = new GpxReader(TestDataReader.Open("gpx-real-file.gpx"), new GpxReaderSettings()
            {
                ReadMetadata = true
            })) {
                var target = GpxDocument.Load(reader);

                Assert.Equal(3, target.Waypoints.Count);
                Assert.Equal(2, target.Routes.Count);
                Assert.Single(target.Tracks);
            }
        }
Exemple #3
0
        public void Save_SavesDataToFile()
        {
            string path = PathHelper.GetTempFilePath("gpxdocument-save-test.gpx");

            var target = GpxDocument.Load(PathHelper.RealGpxFilePath);

            target.Save(path);

            var original = XDocument.Load(PathHelper.RealGpxFilePath);
            var saved    = XDocument.Load(path);

            Assert.True(XDocumentExtensions.DeepEqualsWithNormalization(original, saved));
        }
        public void Load_IGpxReader_LoadsEntitiesFromReader()
        {
            using (var reader = new GpxReader(new MemoryStream(GpxTestData.gpx_real_file), new GpxReaderSettings()
            {
                ReadMetadata = true
            })) {
                var target = GpxDocument.Load(reader);

                Assert.Equal(3, target.Waypoints.Count);
                Assert.Equal(2, target.Routes.Count);
                Assert.Equal(1, target.Tracks.Count);
            }
        }
        public void Save_SavesDataToFile()
        {
            string path = "TestFiles\\gpxdocument-save-test.gpx";

            File.Delete(path);

            var target = GpxDocument.Load("../../src/Tests.SpatialLite.Gps/Data/Gpx/gpx-real-file.gpx");

            target.Save(path);

            var original = XDocument.Load("../../src/Tests.SpatialLite.Gps/Data/Gpx/gpx-real-file.gpx");
            var saved    = XDocument.Load(path);

            Assert.True(XDocumentExtensions.DeepEqualsWithNormalization(original, saved, null));
        }
Exemple #6
0
        public void Load_string_ThrowsExceptionIfFileDoesntExists()
        {
            string path = "non-existing-file.gpx";

            Assert.Throws <FileNotFoundException>(() => GpxDocument.Load(path));
        }
Exemple #7
0
        public void Load_string_ThrowsExceptionIfPathIsNull()
        {
            string path = null;

            Assert.Throws <ArgumentNullException>(() => GpxDocument.Load(path));
        }
Exemple #8
0
        public void Load_IGpxReader_ThrowsExceptionIfReaderIsNull()
        {
            IGpxReader reader = null;

            Assert.Throws <ArgumentNullException>(() => GpxDocument.Load(reader));
        }