Changeset 13355 for branches/Async
- Timestamp:
- 11/24/15 12:49:34 (9 years ago)
- Location:
- branches/Async/HeuristicLab.Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Async/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SamplesUtils.cs
r13237 r13355 1 1 using System; 2 2 using System.Linq; 3 using System.Threading;4 3 using HeuristicLab.Algorithms.ALPS; 5 4 using HeuristicLab.Algorithms.EvolutionStrategy; … … 18 17 19 18 public static void RunAlgorithm(IAlgorithm a) { 20 var trigger = new EventWaitHandle(false, EventResetMode.ManualReset);21 19 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; }; 24 21 a.Prepare(); 25 22 a.Start(); 26 trigger.WaitOne(); 27 28 Assert.AreEqual(ex, null); 23 Assert.IsNull(ex); 29 24 } 30 25 -
branches/Async/HeuristicLab.Tests/HeuristicLab.Scripting-3.3/ScriptingUtils.cs
r12012 r13355 21 21 22 22 using System; 23 using System.Threading;24 23 using HeuristicLab.Scripting; 25 24 using Microsoft.VisualStudio.TestTools.UnitTesting; … … 33 32 34 33 public static void RunScript(CSharpScript s) { 35 var trigger = new EventWaitHandle(false, EventResetMode.ManualReset);36 34 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(); 42 37 Assert.IsNull(ex); 43 38 }
Note: See TracChangeset
for help on using the changeset viewer.