public void ConvertToCelcius() { var fn = Path.Combine(TestData.DataPath, "CalculationTests.xlsx"); Series s = new ExcelDataReaderSeries(fn, "ConvertToCelcius", "Date", "value"); s.Units = "degrees C"; s.Name = "series1"; CalculationSeries c = new CalculationSeries(); c.Parser.VariableResolver.Add("series1", s); c.Expression = "5/9*(series1-32)"; c.Read(); // c.WriteToConsole(); c.Clear(); c.Calculate(); //t,t.AddDays(3)); c.WriteToConsole(); Assert.AreEqual(0, c[0].Value, 0.01); Assert.AreEqual(100, c[1].Value, 0.01); }
public void ConvertToCelcius() { var fn = Path.Combine(TestData.DataPath, "calculationtests_convert.csv"); var csv = new CsvFile(fn); Series s = new DataTableSeries(csv, TimeInterval.Daily, "Date", "value"); s.Units = "degrees C"; s.Name = "series1"; CalculationSeries c = new CalculationSeries(); c.Parser.VariableResolver.Add("series1", s); c.Expression = "5/9*(series1-32)"; c.Read(); // c.WriteToConsole(); c.Clear(); c.Calculate(); //t,t.AddDays(3)); c.WriteToConsole(); Assert.AreEqual(0, c[0].Value, 0.01); Assert.AreEqual(100, c[1].Value, 0.01); }