Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13355


Ignore:
Timestamp:
11/24/15 12:49:34 (8 years ago)
Author:
jkarder
Message:

#2258: updated unit test utils

Location:
branches/Async/HeuristicLab.Tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Async/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SamplesUtils.cs

    r13237 r13355  
    11using System;
    22using System.Linq;
    3 using System.Threading;
    43using HeuristicLab.Algorithms.ALPS;
    54using HeuristicLab.Algorithms.EvolutionStrategy;
     
    1817
    1918    public static void RunAlgorithm(IAlgorithm a) {
    20       var trigger = new EventWaitHandle(false, EventResetMode.ManualReset);
    2119      Exception ex = null;
    22       a.Stopped += (src, e) => { trigger.Set(); };
    23       a.ExceptionOccurred += (src, e) => { ex = e.Value; trigger.Set(); };
     20      a.ExceptionOccurred += (sender, e) => { ex = e.Value; };
    2421      a.Prepare();
    2522      a.Start();
    26       trigger.WaitOne();
    27 
    28       Assert.AreEqual(ex, null);
     23      Assert.IsNull(ex);
    2924    }
    3025
  • branches/Async/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/ScriptingUtils.cs

    r12012 r13355  
    2121
    2222using System;
    23 using System.Threading;
    2423using HeuristicLab.Scripting;
    2524using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    3332
    3433    public static void RunScript(CSharpScript s) {
    35       var trigger = new EventWaitHandle(false, EventResetMode.ManualReset);
    3634      Exception ex = null;
    37 
    38       s.ScriptExecutionFinished += (sender, e) => { ex = e.Value; trigger.Set(); };
    39       s.ExecuteAsync();
    40       trigger.WaitOne();
    41 
     35      s.ScriptExecutionFinished += (sender, e) => { ex = e.Value; };
     36      s.Execute();
    4237      Assert.IsNull(ex);
    4338    }
Note: See TracChangeset for help on using the changeset viewer.