public void GenericTools_Data_Flatdatabase_Performance() { var file = Guid.NewGuid().ToString(); var times = 100 * 1000; var db = new FlatDatabase <SampleModel>(file); var saving = Timing.Measure(() => { for (int i = 0; i < times; i++) { db.Add(new SampleModel { Age = 17, Title = "i" + i, Type = ModelType.Example }); } db.SaveChanges(); }); MakeSure.That(db.Count).Is(times); File.Delete(file); }
public void GenericTools_Data_Flatdatabase() { var file = Guid.NewGuid().ToString(); var db = new FlatDatabase <SampleModel>(file).Load(); //should not have any files in the database MakeSure.That(db.Count).Is(0); //add a new model to the database db.Add(new SampleModel { Age = 17 }); //save changes (persist to file) db.SaveChanges(); //make sure entry was saved correctly MakeSure.That(db.Count).Is(1); //reload the database from file and check again MakeSure.That(db.Load().Count).Is(1); File.Delete(file); }