public void TimeDataPointTestTimespan() { // tests init with time span and saving and loading to db using (var db = new DatabaseSetup(Utili.GetCurrentMethodAndClass())) { db.ClearTable(TimeDataPoint.TableName); var tp = new TimeDataPoint(new TimeSpan(0, 1, 0), 1, null, 1, db.ConnectionString, Guid.NewGuid().ToStrGuid()); tp.SaveToDB(); (tp.Time.TotalMinutes).Should().Be(1); var datapoints = new ObservableCollection <TimeDataPoint>(); TimeDataPoint.LoadFromDatabase(datapoints, db.ConnectionString, false); (1).Should().Be(datapoints.Count); (datapoints[0].Time.TotalMinutes).Should().Be(1); db.Cleanup(); } }
public void TimeDataPointTest() { // tests saving and loading using (var db = new DatabaseSetup(Utili.GetCurrentMethodAndClass())) { db.ClearTable(TimeDataPoint.TableName); var tp = new TimeDataPoint(new DateTime(2010, 1, 1), 1, null, 1, db.ConnectionString, Guid.NewGuid().ToStrGuid()); tp.SaveToDB(); tp = new TimeDataPoint(new TimeSpan(2010, 1, 1), 1, null, 1, db.ConnectionString, Guid.NewGuid().ToStrGuid()); tp.SaveToDB(); var datapoints = new ObservableCollection <TimeDataPoint>(); TimeDataPoint.LoadFromDatabase(datapoints, db.ConnectionString, false); (2).Should().Be(datapoints.Count); db.Cleanup(); } }