public void TestThatLoadingDataWorks() { var reader = new CsvStorage(); var data = reader.Get(); Assert.AreEqual(2, data.Count()); }
/// <summary> /// Splits database in 2 files /// </summary> public static void SplitDatabase() { var database = RestoreObject <AIAccount>("Resources/AiDatabase"); Console.WriteLine(database.ToList().Count); CsvStorage.StoreObject(database.Take(478), "Resources/TrainData"); //slightly more than 70% CsvStorage.StoreObject(database.Skip(478), "Resources/TestData"); }
public void LoadAntennaData(SphericAntennaArgs args, string file = "PCB_868_tot.csv") { var setup = new CsvStorageSetup(new FileInfo(Path.Combine(APP_LOCATION, file)), 1); var parser = new CsvToAntennaGainParser(24); var csv = new CsvStorage <DataRow>(setup, parser, new AntennaGainToCsvParser()); csv.Read(); args.GainMatrix = parser.GetGainMatrix(); }
private ArgumentsBase ReadSphericAntenna(string file) { var spa = ReadJson <SphericAntennaArgs>(file); // TODO: remove magic numer that is used to read csv table var columns = 24; var antennaDataFile = Path.Combine(_pipe.Options.Workspace, spa.DataSource); var setup = new CsvStorageSetup(new FileInfo(antennaDataFile), 1); var parser = new CsvToAntennaGainParser(columns); var csv = new CsvStorage <DataRow>(setup, parser, new AntennaGainToCsvParser()); csv.Read(); spa.GainMatrix = parser.GetGainMatrix(); return(spa); }
public void TestThatStoringDataWorks() { var data = new List <IPerson> { new Person { ID = 1, FirstName = "John", LastName = "Doe", State = HealthState.Infected, InfectedOn = DateTime.Today, LastChange = DateTime.Now }, new Person { ID = 2, FirstName = "Jane", LastName = "Doe", State = HealthState.Cured, InfectedOn = new DateTime(2021, 02, 10), LastChange = DateTime.Now } }; var writer = new CsvStorage(); writer.Save(data); }
private static void StoreDatabase() { CsvStorage.StoreObject(_aiAccounts, "Resources/AiDatabase"); }