Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11483


Ignore:
Timestamp:
10/21/14 10:31:39 (10 years ago)
Author:
bburlacu
Message:

#2211: Updated script unit tests to wait for the script thread to finish before validating results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/GridSearchScriptTest.cs

    r11466 r11483  
    2525using System.Linq;
    2626using System.Reflection;
     27using System.Threading;
    2728using HeuristicLab.Common;
    2829using HeuristicLab.Core;
     
    4445    private const string SamplesDirectory = SamplesUtils.Directory;
    4546
     47    private readonly ManualResetEvent manualResetEvent = new ManualResetEvent(false);
     48
    4649    [ClassInitialize]
    4750    public static void MyClassInitialize(TestContext testContext) {
     
    7073      }
    7174      finally {
     75        script.ScriptExecutionFinished += script_ExecutionFinished;
    7276        script.Execute();
    7377        var vs = script.VariableStore;
     
    96100      }
    97101      finally {
     102        script.ScriptExecutionFinished += script_ExecutionFinished;
    98103        script.Execute();
    99104        var vs = script.VariableStore;
     
    122127      }
    123128      finally {
     129        script.ScriptExecutionFinished += script_ExecutionFinished;
    124130        script.Execute();
    125131        var vs = script.VariableStore;
     
    148154      }
    149155      finally {
    150         script.Execute();
     156        script.ScriptExecutionFinished += script_ExecutionFinished;
     157        script.Execute();
     158        manualResetEvent.WaitOne();
    151159        var vs = script.VariableStore;
    152160        var solution = (IClassificationSolution)vs["demo_bestSolution"];
     
    191199      }
    192200    }
     201
     202    private void script_ExecutionFinished(object sender, EventArgs a) {
     203      manualResetEvent.Set();
     204    }
    193205    #endregion
    194206  }
Note: See TracChangeset for help on using the changeset viewer.