예제 #1
0
 public GeographyTests()
 {
     geoTrackFile = base.GetXMLData <GPXFile>("GPXFiles/GPXRouteOnly.gpx").ToGeoFile();
     geoFile      = base.GetXMLData <GPXFile>("GPXFiles/HalfMarathon.gpx").ToGeoFile();
     geoCompare1  = base.GetXMLData <GPXFile>("GPXFiles/Compare1.gpx").ToGeoFile();
     geoCompare2  = base.GetXMLData <GPXFile>("GPXFiles/Compare2.gpx").ToGeoFile();
 }
예제 #2
0
        public MergeTests()
        {
            // Split a track file in two (testing for this is done elesewhere) and then
            // keep the origional so we can compare it back to the origional
            trackFile = base.GetXMLData <GPXFile>("GPXFiles/HalfMarathon.gpx").ToGeoFile();
            List <List <GeoCoordinateExtended> > splits = trackFile.Routes[0].Points.Split(new TimeSpan(1, 0, 0));

            part1 = splits[0];
            part2 = splits[1];
        }
예제 #3
0
        public void File_Format_Compare_Distance()
        {
            // ARRANGE
            GeoFile tcxConversion = tcxTrackFile.ToGeoFile();
            GeoFile gpxConversion = gpxTrackFile.ToGeoFile();

            // ACT
            Double tcxDistance = Math.Round(tcxConversion.Routes[0].Points.CalculateTotalDistance(), 0);
            Double gpxDIstance = Math.Round(gpxConversion.Routes[0].Points.CalculateTotalDistance(), 0);

            // ASSERT
            tcxDistance.Should().Be(gpxDIstance);
        }
예제 #4
0
        public void File_Format_Compare_Moving_Time()
        {
            // ARRANGE
            GeoFile  tcxConversion = tcxTrackFile.ToGeoFile();
            GeoFile  gpxConversion = gpxTrackFile.ToGeoFile();
            TimeSpan tcxSpeed;
            TimeSpan gpxSpeed;

            // ACT
            tcxSpeed = tcxConversion.Routes[0].Points.TotalTime(TimeCalculationType.MovingTime);
            gpxSpeed = gpxConversion.Routes[0].Points.TotalTime(TimeCalculationType.MovingTime);

            // ASSERT
            tcxSpeed.TotalMinutes.Should().BeApproximately(gpxSpeed.TotalMinutes, 1.0);
        }
예제 #5
0
        public void Split_Track_By_TimeSpan_AfterEnd()
        {
            // ARRANGE
            GeoFile gpxConversion = gpxTrackFile.ToGeoFile();
            List <List <GeoCoordinateExtended> > result;
            TimeSpan splitTime   = new TimeSpan(5, 0, 0);                                 // 5 hours should be enough to guarantee the split will be after the end
            DateTime compareTime = gpxConversion.Routes[0].Points[0].Time.Add(splitTime); // Work out the actual time of the split

            // ACT
            result = gpxConversion.Routes[0].Points.Split(splitTime);
            Int32 part1Count = result[0].Count;
            Int32 part2Count = result[1].Count;

            // ASSERT
            gpxConversion.Routes[0].Points.Count.Should().Be(part1Count);
            part2Count.Should().Be(0);
        }
예제 #6
0
        public void Split_Track_By_TimeSpan_BeforeStart()
        {
            // ARRANGE
            GeoFile gpxConversion = gpxTrackFile.ToGeoFile();
            List <List <GeoCoordinateExtended> > result;
            TimeSpan splitTime   = new TimeSpan(0, 0, 0);                                 // Absolute start
            DateTime compareTime = gpxConversion.Routes[0].Points[0].Time.Add(splitTime); // Work out the actual time of the split

            // ACT
            result = gpxConversion.Routes[0].Points.Split(splitTime);
            Int32 part1Count = result[0].Count;
            Int32 part2Count = result[1].Count;

            // ASSERT
            part1Count.Should().Be(0);
            gpxConversion.Routes[0].Points.Count.Should().Be(part2Count);
        }
예제 #7
0
        public void Split_Track_By_TimeSpan_Middle()
        {
            // ARRANGE
            GeoFile gpxConversion = gpxTrackFile.ToGeoFile();
            List <List <GeoCoordinateExtended> > result;
            TimeSpan splitTime   = new TimeSpan(1, 0, 0);                                 // 1 hour split for a half marathon seems reasonables
            DateTime compareTime = gpxConversion.Routes[0].Points[0].Time.Add(splitTime); // Work out the actual time of the split

            // ACT
            result = gpxConversion.Routes[0].Points.Split(splitTime);
            DateTime part1EndTime   = result[0][result[0].Count - 1].Time;
            DateTime part2StartTime = result[1][0].Time;

            // ASSERT
            part1EndTime.Ticks.Should().BeLessThan(compareTime.Ticks);
            part1EndTime.Ticks.Should().BeLessThan(part2StartTime.Ticks);
            part2StartTime.Ticks.Should().BeGreaterThan(compareTime.Ticks);
        }
예제 #8
0
        public void Track_Compare_FromGeoFile_Conversion()
        {
            // ARRANGE
            Int32   transformedCount = 0;
            GeoFile geoFile          = gpxTrackFile.ToGeoFile();
            Int32   origionalCount   = geoFile.Routes[0].Points.Count;
            GPXFile gpxFile          = new GPXFile();

            // ACT
            Boolean success = gpxFile.FromGeoFile(geoFile);

            transformedCount = gpxFile.Routes[0].RoutePoints.Count; // Count of transformed track

            // ASSERT
            success.Should().BeTrue();
            gpxFile.Routes.Should().NotBeEmpty();
            gpxFile.Routes[0].RoutePoints.Should().NotBeEmpty();
            origionalCount.Should().Be(transformedCount);
        }
예제 #9
0
        public void Track_Compare_FromGeoFile_Conversion()
        {
            // ARRANGE
            Int32   transformedCount = 0;
            GeoFile geoFile          = tcxTrackFile.ToGeoFile();
            Int32   origionalCount   = geoFile.Routes[0].Points.Count;
            TCXFile tcxFile          = new TCXFile();

            // ACT
            Boolean success       = tcxFile.FromGeoFile(geoFile);
            Double  totalDistance = geoFile.Routes[0].Points.CalculateTotalDistance();

            transformedCount = tcxFile.Activities.Activity[0].Laps[0].Track.TrackPoints.Count; // Count of transformed track

            // ASSERT
            success.Should().BeTrue();
            tcxFile.Activities.Activity.Should().NotBeEmpty();
            tcxFile.Activities.Activity[0].Laps.Should().NotBeEmpty();
            tcxFile.Activities.Activity[0].Laps[0].DistanceMeters.Should().Be(totalDistance);
            origionalCount.Should().Be(transformedCount);
        }
예제 #10
0
 public SmoothTests()
 {
     trackFile = base.GetXMLData <GPXFile>("GPXFiles/HalfMarathon.gpx").ToGeoFile();
 }