#region License Information /* HeuristicLab * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Threading; using HeuristicLab.Algorithms.GeneticAlgorithm; using HeuristicLab.Optimization; using HeuristicLab.Problems.TestFunctions; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace HeuristicLab.Clients.Hive.Tests { [TestClass] public class ExperimentManagerTests { private TestContext testContextInstance; public TestContext TestContext { get { return testContextInstance; } set { testContextInstance = value; } } [ClassInitialize] public static void MyClassInitialize(TestContext testContext) { //ServiceLocator.Instance = new MockServiceLocator(); } [TestMethod] public void TestExperimentUpload() { var rhc = new RefreshableHiveExperiment(); var optimizer = CreateOptimizer(); rhc.HiveJobs.Add(new OptimizerHiveJob(optimizer)); HiveClient.StartExperiment((Exception ex) => TestContext.WriteLine(ex.ToString()), rhc, new CancellationToken()); while (rhc.ExecutionState != Core.ExecutionState.Stopped) { Thread.Sleep(500); } } private IOptimizer CreateOptimizer() { var ga = new GeneticAlgorithm(); ga.Engine = new SequentialEngine.SequentialEngine(); ga.Problem = new SingleObjectiveTestFunctionProblem(); return ga; } } }