Пример #1
0
        public void TestThatLoadingDataWorks()
        {
            var reader = new CsvStorage();
            var data   = reader.Get();

            Assert.AreEqual(2, data.Count());
        }
Пример #2
0
        /// <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");
        }
Пример #3
0
        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();
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
 private static void StoreDatabase()
 {
     CsvStorage.StoreObject(_aiAccounts, "Resources/AiDatabase");
 }