Esempio n. 1
0
 public void MainTest()
 {
     using (Form1 form = new Form1()) {
         string[] files = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\..\..\Test\XMLStore\Failed");
         for (int testId = 0, failedId = files.Count(); testId < 1000; testId++) {
             InitializeDiagramItemsAndRelations(form);
             helper = form.helper;
             string file = Directory.GetCurrentDirectory() + @"\..\..\Test\XMLStore\Failed\Failed_" + failedId.ToString() + ".xml";
             helper.SerializeToXMLFile(file);
             for (int i = 0; i < 100; i++)
                 helper.DoBestFit();
             bool isFailed = IsWrongBestFit(ref failedId);
             if (!isFailed) File.Delete(file);
             form.clear(null, null);
         }
     }
 }
Esempio n. 2
0
 public void RunFailedTest()
 {
     string[] files = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\..\..\Test\XMLStore\Failed");
        foreach (string file in files) {
        helper = new DiagramHelper();
        helper.DeserializeFromXMLFile(file);
        helper.PrepareForBestFit(new Size(1000, 1000));
        for (int i = 0; i < 2000; i++)
            helper.DoBestFit();
        PointF[] initialLocations = new PointF[helper.DiagramItems.Count];
        int j = 0;
        foreach (var item in helper.DiagramItems) {
            initialLocations[j] = item.Location;
            j++;
        }
        helper.DoBestFit();
        j = 0;
        foreach (var item in helper.DiagramItems) {
            Assert.AreEqual(Math.Round(initialLocations[j].X, 0), Math.Round(item.Location.X, 0), file);
            Assert.AreEqual(Math.Round(initialLocations[j].Y, 0), Math.Round(item.Location.Y, 0), file);
            j++;
        }
        }
 }