private void ReadTestsFromSelectedFolder(object threadInfo)
        {
            ThreadInfo threadInfoObj = (ThreadInfo)threadInfo;

            //get a serializer object so we could search files wth specific pattern
            TestSystemSerializer serializer = threadInfoObj.Serialier;

            string[] files = Directory.GetFiles(threadInfoObj.TestsPath, serializer.TestItemSearchPattern);

            foreach (var fileLocation in files)
            {
                lock (threadLock)
                {
                    using (StreamReader sr = new StreamReader(fileLocation))
                    {
                        string test = sr.ReadToEnd();

                        //check if specific file is a serialized test object
                        //otherwise skip it
                        if (serializer.IsTestValid(test))
                        {
                            TestFile testFile = new TestFile();
                            testFile.TestName     = serializer.Deserialize(test).TestName;
                            testFile.TestLocation = fileLocation;

                            threadInfoObj.TestFiles.Add(testFile);

                            testList.Invoke(new Action(() => testList.Items.Add(testFile.TestName)));
                        }
                    }
                }
            }
        }
        private void testBegin_Click(object sender, EventArgs e)
        {
            if (testList.SelectedItem != null)
            {
                TestFile testFile;
                foreach (var test in testFiles)
                {
                    //we search for specific test in TestFile structure so we could obtain it's path
                    if (test.TestName == testList.SelectedItem.ToString())
                    {
                        testFile = test;
                        break;
                    }
                }

                testPanel.Show();

                currentQuestionIndex  = 0;
                correctQuestionsCount = 0;

                string testString = File.ReadAllText(testFile.TestLocation);

                selectedTest = jsonSerializer.Deserialize(testString);

                ClearQuestionForm();
                SpawnAnswerOptions();
                UpdateQuestionProgress();
            }
        }