public void Read_InvalidLine_ThrowsInvalidDataException(string line)
        {
            var content = $";;;;;;;\n" +
                          $"${line}\n";

            var reader = new SensorCsvReader();

            Assert.Throws <InvalidDataException>(() => reader.Read("anyId", content));
        }
        public void Read_Sensor()
        {
            var id = "2";

            var content = $";Serial number;;;;;;\n" +
                          $"10.12.2019 00:00:37;{id};;;;;;;\n" +
                          $"10.12.2019 00:00:38;{id};;;;;;;\n";

            var reader     = new SensorCsvReader();
            var timeSeries = reader.Read(id, content);

            Assert.Single(timeSeries);

            var timeSerie1 = timeSeries.Where(x => id.Equals(x.Id)).First();

            Assert.Equal(2, timeSerie1.Count);
        }
        public void Read_FirstValueEntry(string dateTimeStr, string valueStr)
        {
            var dateTime = DateTime.ParseExact(dateTimeStr, "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None);
            var value    = double.Parse(valueStr);

            var content = $"DateTime (Local Time);Serial number;Active Energy Import Total;Unit;;;;\n" +
                          $"{dateTime:dd.MM.yyyy HH:mm:ss};2;{value};;;;;\n";

            var reader     = new SensorCsvReader();
            var timeSeries = reader.Read("2", content);

            Assert.Single(timeSeries);

            var timeSerie = timeSeries.First();

            Assert.Single(timeSerie);

            var dataPoint = timeSerie.First();

            Assert.Equal(dataPoint.Value, value, 15);
            Assert.Equal(dataPoint.CapturedAt, dateTime);
        }
        public void Read_SecondAndThirdValueEntry(string dateTimeStr, string value1Str, string value2Str)
        {
            var dateTime = DateTime.ParseExact(dateTimeStr, "dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None);
            var value1   = double.Parse(value1Str);
            var value2   = double.Parse(value2Str);

            var content = $"DateTime (Local Time);Serial number;;;Energy Tariff 1;Unit;Energy Tariff 2;Unit\n" +
                          $"{dateTime:dd.MM.yyyy HH:mm:ss};2;;;{value1};;{value2};\n";

            var reader     = new SensorCsvReader();
            var timeSeries = reader.Read("2", content);

            Assert.Single(timeSeries);

            var timeSerie = timeSeries.First();

            Assert.Single(timeSerie);

            var dataPoint = timeSerie.First();

            Assert.Equal(dataPoint.Value, value1 + value2, 15);
            Assert.Equal(dataPoint.CapturedAt, dateTime);
        }