Example #1
0
        static void Main(string[] args)
        {
            try
            {
                var jsonDeserializer = new JsonDeserialize();
                var jsonAnalyze      = new JsonAnalyze();
                var resultFormat     = new ResultFormat();

                var testResults = jsonDeserializer.GetResults("StudentsResults.json");

                var exampleQuery =
                    "-name Mike -minmark 2 -maxmark 5 -datefrom 01/12/2013 -dateto 08/09/2019 -test Math -sort Assessment ascending";

                while (true)
                {
                    Console.WriteLine("Hello! Please input your criteria according to the example:");

                    Console.WriteLine("\n" + exampleQuery);

                    Console.WriteLine(
                        "\nFirst argument in sort must be one of these: NameStudent | NameTest | DateTest | Assessment");

                    Console.WriteLine("\nSecond argument  must be: ascending or descending ");

                    var testResultsAnalyzed = jsonAnalyze.Filter(Console.ReadLine());


                    foreach (var s in testResultsAnalyzed)
                    {
                        resultFormat.GetOutput(s);
                    }

                    Console.WriteLine("\nIf you want to exit press y or press other button");

                    if (Console.ReadLine() == "y")
                    {
                        break;
                    }
                }
            }

            catch (FileNotFoundException ex)
            {
                Console.WriteLine(ex);
            }
            catch (InvalidOperationException ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #2
0
        public void SetUp()
        {
            path = "Data.json";

            jsonAnalyze = new JsonAnalyze();
        }