public void Filter_CorrectParameters_3StringResult() { //arrange var exampleQuery = "-name Mike -minmark 2 -maxmark 5 -datefrom 01/12/2013 -dateto 08/09/2019 -test Math -sort Assessment asc"; //act var filteredResults = jsonAnalyze.Filter(exampleQuery); //assert Assert.That(filteredResults.Count(), Is.EqualTo(3)); }
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); } }