public void ErrorOnWrongDataColumnHeadingsFile()
        {
            var       h = new LeMondConcreateProviderCtorHelper(wrongColumnHeadings);
            Exception e = ExceptionAssert.Throws <Exception>(() => new LeMondRevolutionCsvDataProvider(h.SourceName, h.Parser, h.FirstRow));

            StringAssert.Contains(e.Message, "correct data fields");
        }
 public void TestFW25ConvertSpeedToKilometersPerHour()
 {
     var h = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);
     var provider = new LeMondGForceSTNCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
     double d = provider.ConvertSpeedToKilometersPerHour(6.2);
     Assert.AreEqual(10.0, Math.Round(d, 1));
 }
 public void TestFW31ConvertDistanceToKilometers()
 {
     var h = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);
     h.FirstRow[1] = Version0_31;
     var provider = new LeMondGForceSTNCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
     double d = provider.ConvertDistanceToKilometers(3.1);
     Assert.AreEqual(3.1, Math.Round(d, 1));
 }
        public void TestConvertDistanceToKilometers()
        {
            var    h        = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);
            var    provider = new LeMondGForceCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
            double d        = provider.ConvertDistanceToKilometers(3.1);

            Assert.AreEqual(3.1, d);
        }
        public void TestConvertSpeedToKilometersPerHour()
        {
            var    h        = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);
            var    provider = new LeMondGForceCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
            double d        = provider.ConvertSpeedToKilometersPerHour(10.0);

            Assert.AreEqual(10.0, d);
        }
        public void ErrorOnMissingColumnsOnMiddleRow()
        {
            var h = new LeMondConcreateProviderCtorHelper(missingColumnsMiddleRow);
            var provider = new LeMondGForceCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
            Assert.AreEqual(new DateTime(2012, 01, 02, 16, 31, 0, DateTimeKind.Local), provider.StartTime);

            // lines
            Exception e = ExceptionAssert.Throws<Exception>(() => provider.DataLines.Single());
            StringAssert.Contains(e.Message, "Missing data on row 1");
        }
        public void TestFW31ConvertDistanceToKilometers()
        {
            var h = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);

            h.FirstRow[1] = Version0_31;
            var    provider = new LeMondGForceSTNCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
            double d        = provider.ConvertDistanceToKilometers(3.1);

            Assert.AreEqual(3.1, Math.Round(d, 1));
        }
        public void ErrorOnMissingColumnsOnMiddleRow()
        {
            var h        = new LeMondConcreateProviderCtorHelper(missingColumnsMiddleRow);
            var provider = new LeMondGForceCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);

            Assert.AreEqual(new DateTime(2012, 01, 02, 16, 31, 0, DateTimeKind.Local), provider.StartTime);

            // lines
            Exception e = ExceptionAssert.Throws <Exception>(() => provider.DataLines.Single());

            StringAssert.Contains(e.Message, "Missing data on row 1");
        }
        public void TestDateAndTimeAndLines()
        {
            var h = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);
            var provider = new LeMondGForceSTNCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
            Assert.AreEqual(new DateTime(2011, 12, 30, 15, 02, 0, DateTimeKind.Local), provider.StartTime);

            // lines
            // Single() will make sure we have one and only one line
            var line = provider.DataLines.Single();
            Assert.AreEqual(line.Time, "00:00:01");
            Assert.AreEqual(line.Speed, "2.0");
            Assert.AreEqual(line.Distance, "3.0");
            Assert.AreEqual(line.Power, "4");
            Assert.AreEqual(line.HeartRate, "5");
            Assert.AreEqual(line.Rpm, "6");
            Assert.AreEqual(line.Calories, "7");
        }
        public void TestMissingColumnsOnLastRow()
        {
            var h        = new LeMondConcreateProviderCtorHelper(missingColumnsLastRow);
            var provider = new LeMondGForceCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);

            Assert.AreEqual(new DateTime(2012, 01, 02, 16, 31, 0, DateTimeKind.Local), provider.StartTime);

            // lines
            // Single() will make sure we have one and only one line
            var line = provider.DataLines.Single();

            Assert.AreEqual(line.Time, "00:00:01");
            Assert.AreEqual(line.Speed, "2.0");
            Assert.AreEqual(line.Distance, "3.0");
            Assert.AreEqual(line.Power, "4");
            Assert.AreEqual(line.HeartRate, "5");
            Assert.AreEqual(line.Rpm, "6");
            Assert.AreEqual(line.Calories, "7");
        }
        public void TestDateAndTimeAndLines()
        {
            var h        = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);
            var provider = new LeMondGForceSTNCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);

            Assert.AreEqual(new DateTime(2011, 12, 30, 15, 02, 0, DateTimeKind.Local), provider.StartTime);

            // lines
            // Single() will make sure we have one and only one line
            var line = provider.DataLines.Single();

            Assert.AreEqual(line.Time, "00:00:01");
            Assert.AreEqual(line.Speed, "2.0");
            Assert.AreEqual(line.Distance, "3.0");
            Assert.AreEqual(line.Power, "4");
            Assert.AreEqual(line.HeartRate, "5");
            Assert.AreEqual(line.Rpm, "6");
            Assert.AreEqual(line.Calories, "7");
        }
 public void ErrorOnWrongDataColumnHeadingsFile()
 {
     var h = new LeMondConcreateProviderCtorHelper(wrongColumnHeadings);
     Exception e = ExceptionAssert.Throws<Exception>(() => new LeMondGForceSTNCsvDataProvider(h.SourceName, h.Parser, h.FirstRow));
     StringAssert.Contains(e.Message, "correct data fields");
 }
        public void TestMissingColumnsOnLastRow()
        {
            var h = new LeMondConcreateProviderCtorHelper(missingColumnsLastRow);
            var provider = new LeMondGForceCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
            Assert.AreEqual(new DateTime(2012, 01, 02, 16, 31, 0, DateTimeKind.Local), provider.StartTime);

            // lines
            // Single() will make sure we have one and only one line
            var line = provider.DataLines.Single();
            Assert.AreEqual(line.Time, "00:00:01");
            Assert.AreEqual(line.Speed, "2.0");
            Assert.AreEqual(line.Distance, "3.0");
            Assert.AreEqual(line.Power, "4");
            Assert.AreEqual(line.HeartRate, "5");
            Assert.AreEqual(line.Rpm, "6");
            Assert.AreEqual(line.Calories, "7");
        }
 public void TestConvertDistanceToKilometers()
 {
     var h = new LeMondConcreateProviderCtorHelper(goodOneDataPoint);
     var provider = new LeMondGForceCsvDataProvider(h.SourceName, h.Parser, h.FirstRow);
     double d = provider.ConvertDistanceToKilometers(3.1);
     Assert.AreEqual(3.1, d);
 }