Beispiel #1
0
 /// <summary>Konstruktor, ami betölti az eddig feldolgozott fájlok információit.</summary>
 public TextAnalyticsFilesInfo()
 {
     if (File.Exists(c_dbFile))
     {
         ta = (TextAnalyticsXML)XMLObject.XMLToObject(c_dbFile, typeof(TextAnalyticsXML));
     }
     else
     {
         ta = new TextAnalyticsXML();
     }
 }
        private void CheckContent(string c_SampleResultFile)
        {
            List <EntropyResult> erl1 = (List <EntropyResult>)XMLObject.XMLToObject(c_SampleResultFile, typeof(List <EntropyResult>));
            List <EntropyResult> erl2 = (List <EntropyResult>)XMLObject.XMLToObject(ec.ResultFile, typeof(List <EntropyResult>));

            Assert.IsTrue(erl1.Count == erl2.Count);
            foreach (EntropyResult er1 in erl1)
            {
                CheckContentItem(erl1, er1);
            }
        }
Beispiel #3
0
 private void LoadLogic()
 {
     if (!File.Exists(C_DefaultLogicFile))
     {
         throw new EntropyCalculatorException(string.Format(C_LogicFileNotExist, C_DefaultLogicFile));
     }
     try
     {
         logic = (EntropyCalculationLogic)XMLObject.XMLToObject(
             CalculationLogic, typeof(EntropyCalculationLogic));
     }
     catch (Exception ex)
     {
         throw new EntropyCalculatorException(string.Format(C_LoadLogicError, C_DefaultLogicFile), ex);
     }
 }
Beispiel #4
0
        public void TestXMLObject()
        {
            A a1 = new A()
            {
                sA = "sA szöveg", iA = 1, dA = 2.3, bA = true
            };

            a1.b.Add(new B()
            {
                sB = "sB 1 szöveg"
            });
            a1.b.Add(new B()
            {
                sB = "sB 2 szöveg"
            });

            const string c_TestXMLFile = @"RunTimeTest\a.xml";

            XMLObject.ObjectToXML(c_TestXMLFile, a1);
            A a2 = (A)XMLObject.XMLToObject(c_TestXMLFile, typeof(A));

            Assert.IsTrue(a1.sA == a2.sA);
            Assert.IsTrue(a1.iA == a2.iA);
            Assert.IsTrue(a1.dA == a2.dA);
            Assert.IsTrue(a1.bA == a2.bA);
            Assert.IsTrue(a1.b.Count == 2);
            Assert.IsTrue(a1.b.Count == a2.b.Count);
            Assert.IsTrue(a1.b[0].sB == a2.b[0].sB);
            Assert.IsTrue(a1.b[1].sB == a2.b[1].sB);

            const string cSA = "sA másik szöveg";

            a2.sA = cSA;

            XMLObject.ObjectToXML(c_TestXMLFile, a2);
            A a3 = (A)XMLObject.XMLToObject(c_TestXMLFile, typeof(A));

            Assert.IsTrue(a3.sA == cSA);
        }