/
GPXFileReaderTest.cs
94 lines (85 loc) · 3.07 KB
/
GPXFileReaderTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using Microsoft.VisualStudio.TestTools.UnitTesting;
using theRightDirection.Library.UnitTesting;
using FluentAssertions;
using System.IO;
using BikeTouringGISLibrary.Model;
using BikeTouringGIS.Controls;
using BikeTouringGISLibrary.Services;
namespace BikeTouringGISLibrary.UnitTests
{
[TestClass]
public class GPXFileReaderTest : UnitTestingBase
{
private GeometryFactory _geometryFactory;
[TestMethod]
// bug #69
public void LoadFile_All_WayPoints_Do_Have_Description()
{
var gpxInfo = LoadGPXData("dwingeloo.gpx");
foreach (var wpt in gpxInfo.WayPoints)
{
wpt.Name.Should().NotBeNullOrEmpty(wpt.Points[0].ToString());
}
}
[TestMethod]
// bug #34
public void LoadFile_Check_If_All_Have_Length()
{
var gpxInfo = LoadGPXData("Sample.gpx");
gpxInfo.Tracks.ForEach(x => x.IsConvertedToRoute = true);
_geometryFactory.CreateGeometries();
foreach (var route in gpxInfo.Routes)
{
var layer = new BikeTouringGISLayer("testroute", route);
layer.Extent.Should().NotBeNull($"route, {route.Name}");
}
}
[TestMethod]
public void LoadFile_Counts_Tracks_Routes_Waypoints_Are_Correct()
{
var gpxInfo = LoadGPXData("Sample.gpx");
gpxInfo.Routes.Count.ShouldBeEquivalentTo(2);
gpxInfo.Tracks.Count.ShouldBeEquivalentTo(11);
gpxInfo.WayPoints.Count.ShouldBeEquivalentTo(49);
}
[TestMethod]
// bug #43
public void LoadFile_Counts_Tracks_Routes_Waypoints_Are_Correct2()
{
var gpxInfo = LoadGPXData("BRM300BNK16 v2.gpx");
gpxInfo.Routes.Count.ShouldBeEquivalentTo(0);
gpxInfo.Tracks.Count.ShouldBeEquivalentTo(8);
gpxInfo.WayPoints.Count.ShouldBeEquivalentTo(5);
}
[TestMethod]
// #100 file gecorrigeerd en geen fouten
public void LoadFile_Counts_Waypoints_Are_Correct()
{
var gpxInfo = LoadGPXData("pois.gpx");
gpxInfo.Routes.Count.ShouldBeEquivalentTo(0);
gpxInfo.Tracks.Count.ShouldBeEquivalentTo(0);
gpxInfo.WayPoints.Count.ShouldBeEquivalentTo(157);
}
[TestMethod]
// #100
public void LoadFile_Counts_Waypoints_Are_Correct2()
{
var gpxInfo = LoadGPXData("pois2.gpx");
gpxInfo.Routes.Count.ShouldBeEquivalentTo(0);
gpxInfo.Tracks.Count.ShouldBeEquivalentTo(0);
gpxInfo.WayPoints.Count.ShouldBeEquivalentTo(157);
}
[TestInitialize]
public void Setup()
{
}
private GpxInformation LoadGPXData(string fileName)
{
var fileReader = new GpxFileReader();
var path = Path.Combine(UnitTestDirectory, fileName);
var gpxInfo = fileReader.LoadFile(path);
_geometryFactory = new GeometryFactory(gpxInfo);
return gpxInfo;
}
}
}