public void TestSingleLapSingleNoTrackTcx() { var expectedActivityTime = new DateTime(6, 5, 4, 3, 2, 1, DateTimeKind.Utc); var writer = new TcxWriter(textWriter); writer.StartActivity(expectedActivityTime, TcxSport.Biking); writer.StartLap(expectedActivityTime); writer.EndLap(); writer.EndActivity(); writer.Dispose(); var root = XElement.Parse(result.ToString()); var activities = GetActivities(root); var activity = activities.Single(); Assert.AreEqual(activity.Sport, "Biking"); Assert.AreEqual("0006-05-04T03:02:01Z", activity.Id); var lap = activity.Laps.Single(); Assert.AreEqual("0", lap.TotalTimeSeconds); Assert.AreEqual("0", lap.DistanceMeters); Assert.AreEqual("0", lap.Calories); Assert.AreEqual("Active", lap.Intensity); Assert.AreEqual("Manual", lap.TriggerMethod); }
public void TestTwoLapsWithTwoTrackPointsEachTcx() { var writer = new TcxWriter(textWriter); Action writeTrackPoints = () => { writer.StartTrackPoint(); writer.WriteTrackPointCadence(1); writer.WriteTrackPointElapsedCalories(2); writer.WriteTrackPointElapsedDistanceMeters(3.3); writer.WriteTrackPointHeartRateBpm(4); writer.WriteTrackPointPowerWatts(5); writer.WriteTrackPointSpeedMetersPerSecond(6.6); writer.WriteTrackPointTime(point1Time); writer.EndTrackPoint(); writer.StartTrackPoint(); writer.WriteTrackPointCadence(13); writer.WriteTrackPointElapsedCalories(14); writer.WriteTrackPointElapsedDistanceMeters(15.15); writer.WriteTrackPointHeartRateBpm(16); writer.WriteTrackPointPowerWatts(17); writer.WriteTrackPointSpeedMetersPerSecond(18.18); writer.WriteTrackPointTime(point2Time); writer.EndTrackPoint(); }; var expectedActivityTime = new DateTime(6, 5, 4, 3, 2, 1, DateTimeKind.Utc); writer.StartActivity(expectedActivityTime, TcxSport.Biking); var expectedLap1Time = new DateTime(1, 2, 3, 4, 5, 6, DateTimeKind.Utc); writer.StartLap(expectedLap1Time); writeTrackPoints(); writer.EndLap(); var expectedLap2Time = new DateTime(1, 2, 3, 6, 5, 4, DateTimeKind.Utc); writer.StartLap(expectedLap2Time); writeTrackPoints(); writer.EndLap(); writer.EndActivity(); writer.Dispose(); var root = XElement.Parse(result.ToString()); var activities = GetActivities(root); var activity = activities.Single(); Assert.AreEqual(activity.Sport, "Biking"); Assert.AreEqual("0006-05-04T03:02:01Z", activity.Id); Assert.AreEqual(2, activity.Laps.Count()); AssertLap(activity.Laps.First()); AssertLap(activity.Laps.Last()); }
public void TestEmptyActivityTcx() { var expectedActivityTime = new DateTime(1, 2, 3, 4, 5, 6, DateTimeKind.Utc); var writer = new TcxWriter(textWriter); writer.StartActivity(expectedActivityTime, TcxSport.Other); writer.EndActivity(); writer.Dispose(); var root = XElement.Parse(result.ToString()); var activities = GetActivities(root); var activity = activities.Single(); Assert.AreEqual(activity.Sport, "Other"); Assert.AreEqual("0001-02-03T04:05:06Z", activity.Id); Assert.AreEqual(0, activity.Laps.Count()); }