public void TestReadInitial()
        {
            var examples = Src.LoadKeywordTrainingExamples();

            Assert.AreEqual(examples.Count, 0);
            var queries = Src.LoadMechanicQueries();

            Assert.AreEqual(queries.Count, 0);
        }
示例#2
0
        public override void PerformFunction(MySqlDataManipulator manipulator)
        {
            //Convert all MechanicQueries to RepairJobEntries
            FileSystemDataSource  dataSource = new FileSystemDataSource();
            List <MechanicQuery>  queries    = dataSource.LoadMechanicQueries();
            List <RepairJobEntry> toWrite    = new List <RepairJobEntry>();

            foreach (MechanicQuery query in queries)
            {
                RepairJobEntry toAdd = new RepairJobEntry()
                {
                    Make      = query.Make,
                    Model     = query.Model,
                    Complaint = query.Complaint,
                    Problem   = query.Problem,
                    JobId     = "Unknown",
                    Year      = -1
                };
                toWrite.Add(toAdd);
            }

            //Write all RepairJobEntries to the specified file
            StreamWriter fileWriter = new StreamWriter(FilePath); //This is a CLI for devs, so no worries if this goes wonky

            fileWriter.WriteLine('[');


            foreach (RepairJobEntry entry in toWrite)
            {
                string entryJson = JsonDataObjectUtil <RepairJobEntry> .ConvertObject(entry);

                fileWriter.WriteLine(entryJson);
            }
            fileWriter.WriteLine(']');
            fileWriter.Close();
        }