Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/31/14 10:26:09 (10 years ago)
Author:
jkarder
Message:

#2211:

  • updated/added unit tests
    • added AssemblyInitialize method to load all plugins, create output directories for (script) samples and initialize the MainForm
    • script code is now stored in test resource files
    • refactored unit tests
  • updated (script) samples
  • added Test.cmd
Location:
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/EsGriewankSampleTest.cs

    r11450 r11514  
    2929
    3030namespace HeuristicLab.Tests {
    31   /// <summary>
    32   /// Summary description for EsGriewankSampleTest
    33   /// </summary>
    3431  [TestClass]
    3532  public class EsGriewankSampleTest {
    36     private const string samplesDirectory = SamplesUtils.Directory;
    37 
    38     [ClassInitialize]
    39     public static void MyClassInitialize(TestContext testContext) {
    40       if (!Directory.Exists(samplesDirectory))
    41         Directory.CreateDirectory(samplesDirectory);
    42     }
     33    private const string SampleFileName = "ES_Griewank";
    4334
    4435    [TestMethod]
     
    4738    public void CreateEsGriewankSampleTest() {
    4839      var es = CreateEsGriewankSample();
    49       XmlGenerator.Serialize(es, @"Samples\ES_Griewank.hl");
     40      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     41      XmlGenerator.Serialize(es, path);
    5042    }
    5143
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GATspSampleTest.cs

    r11450 r11514  
    3333  [TestClass]
    3434  public class GATspSampleTest {
    35     private const string samplesDirectory = SamplesUtils.Directory;
    36     [ClassInitialize]
    37     public static void MyClassInitialize(TestContext testContext) {
    38       if (!Directory.Exists(samplesDirectory))
    39         Directory.CreateDirectory(samplesDirectory);
    40     }
    41 
     35    private const string SampleFileName = "GA_TSP";
    4236
    4337    [TestMethod]
     
    4640    public void CreateGaTspSampleTest() {
    4741      var ga = CreateGaTspSample();
    48       XmlGenerator.Serialize(ga, @"Samples\GA_TSP.hl");
     42      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     43      XmlGenerator.Serialize(ga, path);
    4944    }
     45
    5046    [TestMethod]
    5147    [TestCategory("Samples.Execute")]
     
    6359    private GeneticAlgorithm CreateGaTspSample() {
    6460      GeneticAlgorithm ga = new GeneticAlgorithm();
     61
    6562      #region Problem Configuration
    6663      var provider = new TSPLIBTSPInstanceProvider();
     
    7774        ga, 100, 1, 1000, 0.05);
    7875      #endregion
     76
    7977      return ga;
    8078    }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GAVrpSampleTest.cs

    r11450 r11514  
    3434
    3535namespace HeuristicLab.Tests {
    36   /// <summary>
    37   /// Summary description for GAVrpSampleTest
    38   /// </summary>
    3936  [TestClass]
    4037  public class GAVrpSampleTest {
    41     private const string samplesDirectory = SamplesUtils.Directory;
    42     [ClassInitialize]
    43     public static void MyClassInitialize(TestContext testContext) {
    44       if (!Directory.Exists(samplesDirectory))
    45         Directory.CreateDirectory(samplesDirectory);
    46     }
    47 
     38    private const string SampleFileName = "GA_VRP";
    4839
    4940    [TestMethod]
     
    5243    public void CreateGaVrpSampleTest() {
    5344      var ga = CreateGaVrpSample();
    54       XmlGenerator.Serialize(ga, @"Samples\GA_VRP.hl");
     45      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     46      XmlGenerator.Serialize(ga, path);
    5547    }
    5648
     
    7062    private GeneticAlgorithm CreateGaVrpSample() {
    7163      GeneticAlgorithm ga = new GeneticAlgorithm();
     64
    7265      #region Problem Configuration
    7366      VehicleRoutingProblem vrpProblem = new VehicleRoutingProblem();
     
    117110        .Single(), true);
    118111      #endregion
     112
    119113      return ga;
    120114    }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPArtificialAntSampleTest.cs

    r11450 r11514  
    3030
    3131namespace HeuristicLab.Tests {
    32   /// <summary>
    33   /// Summary description for GPArtificialAntSampleTest
    34   /// </summary>
    3532  [TestClass]
    3633  public class GPArtificialAntSampleTest {
    37     private const string samplesDirectory = SamplesUtils.Directory;
    38     [ClassInitialize]
    39     public static void MyClassInitialize(TestContext testContext) {
    40       if (!Directory.Exists(samplesDirectory))
    41         Directory.CreateDirectory(samplesDirectory);
    42     }
     34    private const string SampleFileName = "SGP_SantaFe";
    4335
    4436    [TestMethod]
     
    4739    public void CreateGpArtificialAntSampleTest() {
    4840      var ga = CreateGpArtificialAntSample();
    49       XmlGenerator.Serialize(ga, @"Samples\SGP_SantaFe.hl");
     41      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     42      XmlGenerator.Serialize(ga, path);
    5043    }
    5144
     
    6558    public GeneticAlgorithm CreateGpArtificialAntSample() {
    6659      GeneticAlgorithm ga = new GeneticAlgorithm();
     60
    6761      #region Problem Configuration
    6862      ArtificialAntProblem antProblem = new ArtificialAntProblem();
     
    9488        .Single(), false);
    9589      #endregion
     90
    9691      return ga;
    9792    }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPLawnMowerSampleTest.cs

    r11450 r11514  
    2020#endregion
    2121
    22 using System.IO;
    2322using System.Linq;
    2423using HeuristicLab.Algorithms.GeneticAlgorithm;
     
    2827
    2928namespace HeuristicLab.Tests {
    30   /// <summary>
    31   /// Summary description for GPLawnMowerSampleTest
    32   /// </summary>
    3329  [TestClass]
    3430  public class GPLawnMowerSampleTest {
    35     private const string samplesDirectory = SamplesUtils.Directory;
    36     [ClassInitialize]
    37     public static void MyClassInitialize(TestContext testContext) {
    38       if (!Directory.Exists(samplesDirectory))
    39         Directory.CreateDirectory(samplesDirectory);
    40     }
    41 
    4231    [TestMethod]
    4332    [TestCategory("Samples.Execute")]
     
    5746
    5847      #endregion
    59 
    6048      #region Algorithm Configuration
    6149
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPMultiplexerSampleTest.cs

    r11051 r11514  
    3333  [TestClass]
    3434  public class GPMultiplexerSampleTest {
    35     private const string samplesDirectory = SamplesUtils.Directory;
    36     [ClassInitialize]
    37     public static void MyClassInitialize(TestContext testContext) {
    38       if (!Directory.Exists(samplesDirectory))
    39         Directory.CreateDirectory(samplesDirectory);
    40     }
     35    private const string SampleFileName = "GP_Multiplexer";
    4136
    4237    [TestMethod]
     
    4540    public void CreateGpMultiplexerSampleTest() {
    4641      var ga = CreateGpMultiplexerSample();
    47       var path = Path.Combine(samplesDirectory, "GP_Multiplexer.hl");
     42      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
    4843      XmlGenerator.Serialize(ga, path);
    4944    }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPSymbolicClassificationSampleTest.cs

    r11450 r11514  
    3333
    3434namespace HeuristicLab.Tests {
    35   /// <summary>
    36   /// Summary description for GPSymbolicClassificationSampleTest
    37   /// </summary>
    3835  [TestClass]
    3936  public class GPSymbolicClassificationSampleTest {
    40     private const string samplesDirectory = SamplesUtils.Directory;
    41     [ClassInitialize]
    42     public static void MyClassInitialize(TestContext testContext) {
    43       if (!Directory.Exists(samplesDirectory))
    44         Directory.CreateDirectory(samplesDirectory);
    45     }
     37    private const string SampleFileName = "SGP_SymbClass";
    4638
    4739    [TestMethod]
     
    5042    public void CreateGpSymbolicClassificationSampleTest() {
    5143      var ga = CreateGpSymbolicClassificationSample();
    52       XmlGenerator.Serialize(ga, @"Samples\SGP_SymbClass.hl");
     44      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     45      XmlGenerator.Serialize(ga, path);
    5346    }
    5447
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPSymbolicRegressionSampleTest.cs

    r11450 r11514  
    3333
    3434namespace HeuristicLab.Tests {
    35   /// <summary>
    36   /// Summary description for GPSymbolicRegressionSampleTest
    37   /// </summary>
    3835  [TestClass]
    3936  public class GPSymbolicRegressionSampleTest {
    40     private const string samplesDirectory = SamplesUtils.Directory;
    41     [ClassInitialize]
    42     public static void MyClassInitialize(TestContext testContext) {
    43       if (!Directory.Exists(samplesDirectory))
    44         Directory.CreateDirectory(samplesDirectory);
    45     }
    46 
     37    private const string SampleFileName = "SGP_SymbReg";
    4738
    4839    [TestMethod]
     
    5142    public void CreateGpSymbolicRegressionSampleTest() {
    5243      var ga = CreateGpSymbolicRegressionSample();
    53       XmlGenerator.Serialize(ga, @"Samples\SGP_SymbReg.hl");
     44      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     45      XmlGenerator.Serialize(ga, path);
    5446    }
    5547    [TestMethod]
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPTimeSeriesSampleTest.cs

    r11091 r11514  
    3232  [TestClass]
    3333  public class GPTimeSeriesSampleTest {
    34     private const string samplesDirectory = SamplesUtils.Directory;
    35     [ClassInitialize]
    36     public static void MyClassInitialize(TestContext testContext) {
    37       if (!Directory.Exists(samplesDirectory))
    38         Directory.CreateDirectory(samplesDirectory);
    39     }
     34    private const string SampleFileName = "OSGP_TimeSeries";
    4035
    4136    [TestMethod]
     
    4439    public void CreateGpTimeSeriesSampleTest() {
    4540      var ga = CreateGpTimeSeriesSample();
    46       var path = Path.Combine(samplesDirectory, "OSGP_TimeSeries.hl");
     41      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
    4742      XmlGenerator.Serialize(ga, path);
    4843    }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GaussianProcessRegressionSampleTest.cs

    r11450 r11514  
    2929
    3030namespace HeuristicLab.Tests {
    31   /// <summary>
    32   /// Summary description for GaussianProcessRegressionSampleTest
    33   /// </summary>
    3431  [TestClass]
    3532  public class GaussianProcessRegressionSampleTest {
    36     private const string samplesDirectory = SamplesUtils.Directory;
    37     [ClassInitialize]
    38     public static void MyClassInitialize(TestContext testContext) {
    39       if (!Directory.Exists(samplesDirectory))
    40         Directory.CreateDirectory(samplesDirectory);
    41     }
     33    private const string SampleFileName = "GPR";
    4234
    4335    [TestMethod]
     
    4638    public void CreateGaussianProcessRegressionSampleTest() {
    4739      var gpr = CreateGaussianProcessRegressionSample();
    48       XmlGenerator.Serialize(gpr, @"Samples\GPR.hl");
     40      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     41      XmlGenerator.Serialize(gpr, path);
    4942    }
     43
    5044    [TestMethod]
    5145    [TestCategory("Samples.Execute")]
     
    6660      var regProblem = new RegressionProblem();
    6761      regProblem.Load(provider.LoadData(instance));
     62
    6863      #region Algorithm Configuration
    6964      gpr.Name = "Gaussian Process Regression";
     
    7772      gpr.SetSeedRandomly = true;
    7873      #endregion
     74
    7975      gpr.Engine = new ParallelEngine.ParallelEngine();
    8076      return gpr;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GeSymbolicRegressionSampleTest.cs

    r11450 r11514  
    3030
    3131namespace HeuristicLab.Tests {
    32   /// <summary>
    33   /// Summary description for GeSymbolicRegressionSampleTest
    34   /// </summary>
    3532  [TestClass]
    3633  public class GeSymbolicRegressionSampleTest {
    37     private const string samplesDirectory = SamplesUtils.Directory;
    38     [ClassInitialize]
    39     public static void MyClassInitialize(TestContext testContext) {
    40       if (!Directory.Exists(samplesDirectory))
    41         Directory.CreateDirectory(samplesDirectory);
    42     }
     34    #region artificial ant
     35    private const string GeArtificialAntSampleFileName = "GE_ArtificialAnt";
    4336
    44     #region artificial ant
    4537    [TestMethod]
    4638    [TestCategory("Samples.Create")]
     
    4840    public void CreateGeArtificialAntSampleTest() {
    4941      var geaa = CreateGeArtificialAntSample();
    50       XmlGenerator.Serialize(geaa, @"Samples\GE_ArtificialAnt.hl");
     42      string path = Path.Combine(SamplesUtils.SamplesDirectory, GeArtificialAntSampleFileName + SamplesUtils.SampleFileExtension);
     43      XmlGenerator.Serialize(geaa, path);
    5144    }
    5245
     
    6255    public OffspringSelectionGeneticAlgorithm CreateGeArtificialAntSample() {
    6356      OffspringSelectionGeneticAlgorithm ga = new OffspringSelectionGeneticAlgorithm();
     57
    6458      #region Problem Configuration
    6559      var problem = new HeuristicLab.Problems.GrammaticalEvolution.GEArtificialAntProblem();
     
    7266        ga, 200, 1, 50, 0.05, 200);
    7367      #endregion
     68
    7469      return ga;
    7570    }
     
    7772
    7873    #region symbolic regression
    79     #endregion
     74    private const string GeSymbolicRegressionSampleFileName = "GE_SymbReg";
     75
    8076    [TestMethod]
    8177    [TestCategory("Samples.Create")]
     
    8379    public void CreateGeSymbolicRegressionSampleTest() {
    8480      var geSymbReg = CreateGeSymbolicRegressionSample();
    85       XmlGenerator.Serialize(geSymbReg, @"Samples\GE_SymbReg.hl");
     81      string path = Path.Combine(SamplesUtils.SamplesDirectory, GeSymbolicRegressionSampleFileName + SamplesUtils.SampleFileExtension);
     82      XmlGenerator.Serialize(geSymbReg, path);
    8683    }
    8784
     
    9794    public OffspringSelectionGeneticAlgorithm CreateGeSymbolicRegressionSample() {
    9895      var ga = new OffspringSelectionGeneticAlgorithm();
     96
    9997      #region Problem Configuration
    10098      var problem = new HeuristicLab.Problems.GrammaticalEvolution.GESymbolicRegressionSingleObjectiveProblem();
     
    116114        ga, 1000, 1, 50, 0.05, 200);
    117115      #endregion
     116
    118117      return ga;
    119118    }
     119    #endregion
    120120  }
    121121}
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/IslandGaTspSampleTest.cs

    r11450 r11514  
    3434  [TestClass]
    3535  public class UnitTest1 {
    36     private const string samplesDirectory = SamplesUtils.Directory;
    37     [ClassInitialize]
    38     public static void MyClassInitialize(TestContext testContext) {
    39       if (!Directory.Exists(samplesDirectory))
    40         Directory.CreateDirectory(samplesDirectory);
    41     }
     36    private const string SampleFileName = "IslandGA_TSP";
    4237
    4338    [TestMethod]
     
    4641    public void CreateIslandGaTspSampleTest() {
    4742      var ga = CreateIslandGaTspSample();
    48       XmlGenerator.Serialize(ga, @"Samples\IslandGA_TSP.hl");
     43      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     44      XmlGenerator.Serialize(ga, path);
    4945    }
    5046    [TestMethod]
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/LocalSearchKnapsackSampleTest.cs

    r11450 r11514  
    3030
    3131namespace HeuristicLab.Tests {
    32   /// <summary>
    33   /// Summary description for LocalSearchKnapsackSampleTest
    34   /// </summary>
    3532  [TestClass]
    3633  public class LocalSearchKnapsackSampleTest {
    37     private const string samplesDirectory = SamplesUtils.Directory;
    38     [ClassInitialize]
    39     public static void MyClassInitialize(TestContext testContext) {
    40       if (!Directory.Exists(samplesDirectory))
    41         Directory.CreateDirectory(samplesDirectory);
    42     }
     34    private const string SampleFileName = "LS_Knapsack";
    4335
    4436    [TestMethod]
     
    4739    public void CreateLocalSearchKnapsackSampleTest() {
    4840      var ls = CreateLocalSearchKnapsackSample();
    49       XmlGenerator.Serialize(ls, @"Samples\LS_Knapsack.hl");
     41      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     42      XmlGenerator.Serialize(ls, path);
    5043    }
    5144    [TestMethod]
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/PsoSchwefelSampleTest.cs

    r11450 r11514  
    3232
    3333namespace HeuristicLab.Tests {
    34   /// <summary>
    35   /// Summary description for PsoSchwefelSampleTest
    36   /// </summary>
    3734  [TestClass]
    3835  public class PsoSchwefelSampleTest {
    39     private const string samplesDirectory = SamplesUtils.Directory;
    40     [ClassInitialize]
    41     public static void MyClassInitialize(TestContext testContext) {
    42       if (!Directory.Exists(samplesDirectory))
    43         Directory.CreateDirectory(samplesDirectory);
    44     }
     36    private const string SampleFileName = "PSO_Schwefel";
    4537
    4638    [TestMethod]
     
    4941    public void CreatePsoSchwefelSampleTest() {
    5042      var pso = CreatePsoSchwefelSample();
    51       XmlGenerator.Serialize(pso, @"Samples\PSO_Schwefel.hl");
     43      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     44      XmlGenerator.Serialize(pso, path);
    5245    }
    5346    [TestMethod]
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/RAPGASchedulingSampleTest.cs

    r11450 r11514  
    2929
    3030namespace HeuristicLab.Tests {
    31   /// <summary>
    32   /// Summary description for RAPGASchedulingSampleTest
    33   /// </summary>
    3431  [TestClass]
    3532  public class RAPGASchedulingSampleTest {
    36     private const string samplesDirectory = SamplesUtils.Directory;
    37     [ClassInitialize]
    38     public static void MyClassInitialize(TestContext testContext) {
    39       if (!Directory.Exists(samplesDirectory))
    40         Directory.CreateDirectory(samplesDirectory);
    41     }
     33    private const string SampleFileName = "RAPGA_JSSP";
    4234
    4335    [TestMethod]
     
    4638    public void CreateRAPGASchedulingSampleTest() {
    4739      var ss = CreateRAPGASchedulingSample();
    48       XmlGenerator.Serialize(ss, @"Samples\RAPGA_JSSP.hl");
     40      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     41      XmlGenerator.Serialize(ss, path);
    4942    }
    5043
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SamplesUtils.cs

    r11051 r11514  
    1212namespace HeuristicLab.Tests {
    1313  public static class SamplesUtils {
    14     public const string Directory = @"Samples\";
     14    public const string SamplesDirectory = @"Samples\";
     15    public const string SampleFileExtension = ".hl";
    1516
    1617    public static void RunAlgorithm(IAlgorithm a) {
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/ScatterSearchVRPSampleTest.cs

    r11450 r11514  
    2929
    3030namespace HeuristicLab.Tests {
    31   /// <summary>
    32   /// Summary description for ScatterSearchVRPSampleTest
    33   /// </summary>
    3431  [TestClass]
    3532  public class ScatterSearchVRPSampleTest {
    36     private const string samplesDirectory = SamplesUtils.Directory;
    37     [ClassInitialize]
    38     public static void MyClassInitialize(TestContext testContext) {
    39       if (!Directory.Exists(samplesDirectory))
    40         Directory.CreateDirectory(samplesDirectory);
    41     }
     33    private const string SampleFileName = "SS_VRP";
    4234
    4335    [TestMethod]
     
    4638    public void CreateScatterSearchVRPSampleTest() {
    4739      var ss = CreateScatterSearchVRPSample();
    48       XmlGenerator.Serialize(ss, @"Samples\SS_VRP.hl");
     40      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     41      XmlGenerator.Serialize(ss, path);
    4942    }
    5043
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SimulatedAnnealingRastriginSampleTest.cs

    r11450 r11514  
    3131
    3232namespace HeuristicLab.Tests {
    33   /// <summary>
    34   /// Summary description for SimulatedAnnealingRastriginSampleTest
    35   /// </summary>
    3633  [TestClass]
    3734  public class SimulatedAnnealingRastriginSampleTest {
    38     private const string samplesDirectory = SamplesUtils.Directory;
    39     [ClassInitialize]
    40     public static void MyClassInitialize(TestContext testContext) {
    41       if (!Directory.Exists(samplesDirectory))
    42         Directory.CreateDirectory(samplesDirectory);
    43     }
     35    private const string SampleFileName = "SA_Rastrigin";
    4436
    4537    [TestMethod]
     
    4840    public void CreateSimulatedAnnealingRastriginSampleTest() {
    4941      var sa = CreateSimulatedAnnealingRastriginSample();
    50       XmlGenerator.Serialize(sa, @"Samples\SA_Rastrigin.hl");
     42      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     43      XmlGenerator.Serialize(sa, path);
    5144    }
    5245    [TestMethod]
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/TabuSearchTspSampleTest.cs

    r11450 r11514  
    3030
    3131namespace HeuristicLab.Tests {
    32   /// <summary>
    33   /// Summary description for TabuSearchTspSampleTest
    34   /// </summary>
    3532  [TestClass]
    3633  public class TabuSearchTspSampleTest {
    37     private const string samplesDirectory = SamplesUtils.Directory;
    38     [ClassInitialize]
    39     public static void MyClassInitialize(TestContext testContext) {
    40       if (!Directory.Exists(samplesDirectory))
    41         Directory.CreateDirectory(samplesDirectory);
    42     }
    43 
     34    private const string SampleFileName = "TS_TSP";
    4435
    4536    [TestMethod]
     
    4839    public void CreateTabuSearchTspSampleTest() {
    4940      var ts = CreateTabuSearchTspSample();
    50       XmlGenerator.Serialize(ts, @"Samples\TS_TSP.hl");
     41      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     42      XmlGenerator.Serialize(ts, path);
    5143    }
    5244    [TestMethod]
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/TabuSearchVRPSampleTest.cs

    r11450 r11514  
    3030
    3131namespace HeuristicLab.Tests {
    32   /// <summary>
    33   /// Summary description for TabuSearchVRPSampleTest
    34   /// </summary>
    3532  [TestClass]
    3633  public class TabuSearchVRPSampleTest {
    37     private const string samplesDirectory = SamplesUtils.Directory;
    38     [ClassInitialize]
    39     public static void MyClassInitialize(TestContext testContext) {
    40       if (!Directory.Exists(samplesDirectory))
    41         Directory.CreateDirectory(samplesDirectory);
    42     }
     34    private const string SampleFileName = "TS_VRP";
    4335
    4436    [TestMethod]
     
    4739    public void CreateTabuSearchVRPSampleTest() {
    4840      var vrp = CreateTabuSearchVrpSample();
    49       XmlGenerator.Serialize(vrp, @"Samples\TS_VRP.hl");
     41      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     42      XmlGenerator.Serialize(vrp, path);
    5043    }
    5144    [TestMethod]
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/VnsTspSampleTest.cs

    r11450 r11514  
    3131
    3232namespace HeuristicLab.Tests {
    33   /// <summary>
    34   /// Summary description for VnsTspSampleTest
    35   /// </summary>
    3633  [TestClass]
    3734  public class VnsTspSampleTest {
    38     private const string samplesDirectory = SamplesUtils.Directory;
    39     [ClassInitialize]
    40     public static void MyClassInitialize(TestContext testContext) {
    41       if (!Directory.Exists(samplesDirectory))
    42         Directory.CreateDirectory(samplesDirectory);
    43     }
     35    private const string SampleFileName = "VNS_TSP";
    4436
    4537    [TestMethod]
     
    4840    public void CreateVnsTspSampleTest() {
    4941      var vns = CreateVnsTspSample();
    50       XmlGenerator.Serialize(vns, @"Samples\VNS_TSP.hl");
     42      string path = Path.Combine(SamplesUtils.SamplesDirectory, SampleFileName + SamplesUtils.SampleFileExtension);
     43      XmlGenerator.Serialize(vns, path);
    5144    }
    5245    [TestMethod]
Note: See TracChangeset for help on using the changeset viewer.