List <Test> IDL.getTestList()
        {
            List <Test> testList = (from XElement testElement in TestRoot.Elements()
                                    select testElement.XmlToDOTest()).ToList();

            return(testList);
        }
        List <Test> IDL.getCertainTestsList(Predicate <Test> pred)
        {
            List <Test> testList = (from XElement testElement in TestRoot.Elements()
                                    select testElement.XmlToDOTest()).ToList();
            List <Test> certainTestsList = (from Test test in testList
                                            where pred(test)
                                            select test).ToList();

            return(certainTestsList);
        }
        void IDL.removeTest(int testNumber)
        {
            XElement testElement = (from test in TestRoot.Elements()
                                    where int.Parse(test.Element("TestNumber").Value) == testNumber
                                    select test).FirstOrDefault();

            if (testElement == null)
            {
                throw new TestNumberNotFoundException("thrown from: DL.Dal_XML_imp.removeTest");
            }
            testElement.Remove();
            TestRoot.Save(TestPath);
        }
        void IDL.updateTest(int testNumber, Test updatedTest)
        {
            XElement testElement = (from testItem in TestRoot.Elements()
                                    where int.Parse(testItem.Element("TestNumber").Value) == testNumber
                                    select testItem).FirstOrDefault();

            if (testElement == null)
            {
                throw new TestNumberNotFoundException(testNumber);
            }
            testElement.Remove();
            TestRoot.Add(updatedTest.ToXmlTest());
            TestRoot.Save(TestPath);
        }
        Test IDL.getTest(int testNumber)
        {
            //if (!TraineeRoot.Element("tests").HasElements)
            //    throw new TestersDataSourceIsEmptyException("No Test in the dataSource");
            XElement foundTest = (from XElement testElement in TestRoot.Elements()
                                  where testElement.Element("TestNumber").Value.Equals(testNumber.ToString())
                                  select testElement).FirstOrDefault();

            if (foundTest == null)
            {
                throw new TestersIdNotFoundException(testNumber);
            }
            return(foundTest.XmlToDOTest());
        }
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        int IDL.addTest(Test testToAdd)
        {
            //to do: make a running code for tests
            int testCode   = int.Parse(ConfigRoot.Element("BeginningSerialTestNumber").Element("Value").Value);
            int testNumber = (from test in TestRoot.Elements()
                              where (int.Parse(test.Element("TestNumber").Value) == testToAdd.TestNumber)
                              select(int.Parse(test.Element("TestNumber").Value))).FirstOrDefault();

            if (testNumber != 0)
            {
                throw new TestNumberAlreadyExistsException(testNumber);
            }

            testToAdd.TestNumber = testCode;
            TestRoot.Add(testToAdd.ToXmlTest());
            TestRoot.Save(TestPath);
            ConfigRoot.Element("BeginningSerialTestNumber").Element("Value").Value = (testCode + 1).ToString();
            ConfigRoot.Save(ConfigPath);
            return(testCode);
        }