public static ExerciseSession Create(GpxTrack track)
        {
            var exerciseSession = new ExerciseSession
            {
                Name = track.Name,
                Time = track.Time
            };
            ICollection <TrackSegment> trackSegments = new List <TrackSegment>();

            foreach (var gpxTrackSegment in track.Segments)
            {
                trackSegments.Add(TrackSegment.Create(gpxTrackSegment));
            }
            exerciseSession.Elevation     = ElevationProcessor.SessionElevation(trackSegments);
            exerciseSession.Duration      = DurationProcessor.SessionDuration(trackSegments);
            exerciseSession.Distance      = DistanceProcessor.SessionDistance(trackSegments);
            exerciseSession.Calories      = CaloriesProcessor.GetCaloriesBurned(exerciseSession);
            exerciseSession.Pace          = PaceProcessor.GetAveragePace(exerciseSession);
            exerciseSession.ActivityType  = ActivityProcessor.GetActivityType(exerciseSession);
            exerciseSession.Speed         = SpeedProcessor.GetAverageSpeed(exerciseSession);
            exerciseSession.TrackSegments = trackSegments;

            return(exerciseSession);
        }
示例#2
0
        public void SpeedProcessor_ActivityTypeCycling_SpeedInKmPerHr()
        {
            _cyclingSession.Speed = SpeedProcessor.GetAverageSpeed(_cyclingSession);

            Assert.That(_cyclingSession.Speed, Is.EqualTo(24d));
        }
示例#3
0
        public void SpeedProcessor_ActivityTypeRunning_SpeedInKmPerHr()
        {
            _runningSession.Speed = SpeedProcessor.GetAverageSpeed(_runningSession);

            Assert.That(_runningSession.Speed, Is.EqualTo(12d));
        }