Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OKB/HeuristicLab.Services.OKB.DataAccess/3.3/Tests/UnitTest.cs @ 4945

Last change on this file since 4945 was 4558, checked in by swagner, 14 years ago

Worked on OKB (#1174)

File size: 3.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Services.OKB.DataAccess;
23using Microsoft.VisualStudio.TestTools.UnitTesting;
24
25namespace HeuristicLab.Services.OKB.DataAccess_33.Tests {
26  /// <summary>
27  /// Summary description for UnitTest1
28  /// </summary>
29  [TestClass]
30  public class UnitTest {
31    public UnitTest() {
32      //
33      // TODO: Add constructor logic here
34      //
35    }
36
37    private TestContext testContextInstance;
38
39    /// <summary>
40    ///Gets or sets the test context which provides
41    ///information about and functionality for the current test run.
42    ///</summary>
43    public TestContext TestContext {
44      get {
45        return testContextInstance;
46      }
47      set {
48        testContextInstance = value;
49      }
50    }
51
52    #region Additional test attributes
53    //
54    // You can use the following additional attributes as you write your tests:
55    //
56    // Use ClassInitialize to run code before running the first test in the class
57    // [ClassInitialize()]
58    // public static void MyClassInitialize(TestContext testContext) { }
59    //
60    // Use ClassCleanup to run code after all tests in a class have run
61    // [ClassCleanup()]
62    // public static void MyClassCleanup() { }
63    //
64    // Use TestInitialize to run code before running each test
65    // [TestInitialize()]
66    // public void MyTestInitialize() { }
67    //
68    // Use TestCleanup to run code after each test has run
69    // [TestCleanup()]
70    // public void MyTestCleanup() { }
71    //
72    #endregion
73
74    [TestMethod]
75    public void TestMethod1() {
76      using (OKBDataContext okb = new OKBDataContext()) {
77        okb.AlgorithmParameterIntValues.DeleteAllOnSubmit(okb.AlgorithmParameterIntValues);
78        okb.AlgorithmParameters.DeleteAllOnSubmit(okb.AlgorithmParameters);
79        okb.Experiments.DeleteAllOnSubmit(okb.Experiments);
80        okb.Algorithms.DeleteAllOnSubmit(okb.Algorithms);
81        okb.Problems.DeleteAllOnSubmit(okb.Problems);
82        okb.ProblemClasses.DeleteAllOnSubmit(okb.ProblemClasses);
83        okb.AlgorithmClasses.DeleteAllOnSubmit(okb.AlgorithmClasses);
84        okb.SubmitChanges();
85        AlgorithmClass ac = new AlgorithmClass() { Name = "AlgorithmClass" };
86        ProblemClass pc = new ProblemClass() { Name = "ProblemClass" };
87        Algorithm a = new Algorithm() { Name = "Alg", AlgorithmClass = ac, PlatformId = 1 };
88        Problem p = new Problem() { Name = "Prb", ProblemClass = pc, PlatformId = 1 };
89        Experiment e = new Experiment() { Algorithm = a, Problem = p };
90        AlgorithmParameter ap = new AlgorithmParameter() { Name = "Param", Algorithm = a, DataTypeId = 1 };
91        ap.AlgorithmParameterIntValues.Add(new AlgorithmParameterIntValue() { AlgorithmParameterId = 0, Experiment = e, Value = 23 });
92        okb.AlgorithmClasses.InsertOnSubmit(ac);
93        okb.SubmitChanges();
94      }
95    }
96  }
97}
Note: See TracBrowser for help on using the repository browser.