diff --git a/src/GeneticSharp.Infrastructure.Framework.UnitTests/Threading/TplTaskExecutorTest.cs b/src/GeneticSharp.Infrastructure.Framework.UnitTests/Threading/TplTaskExecutorTest.cs index 55f649a1..1964f093 100644 --- a/src/GeneticSharp.Infrastructure.Framework.UnitTests/Threading/TplTaskExecutorTest.cs +++ b/src/GeneticSharp.Infrastructure.Framework.UnitTests/Threading/TplTaskExecutorTest.cs @@ -217,5 +217,31 @@ public void Start_MaxThreads1_DoNotBlockOtherThreads() otherThread.Stop(); Assert.GreaterOrEqual(otherThreadCount, 2); } + + [Test] + public void Stop_Before_Start() + { + var pipeline = ""; + var target = new TplTaskExecutor(); + target.Add(() => + { + pipeline += "1"; + }); + target.Add(() => + { + Thread.Sleep(100); + pipeline += "2"; + }); + target.Add(() => + { + Thread.Sleep(10); + pipeline += "3"; + }); + + target.Stop(); + var actual = target.Start(); + Assert.IsTrue(actual); + Assert.AreEqual("132", pipeline); + } } }