public void PauseCoroutineFromAnotherThread()
        {
            var coroutineContext = new CoroutineContext(InfiniteCoroutine);

            Assert.IsFalse(coroutineContext.IsStarted);
            Assert.IsFalse(coroutineContext.IsPaused);
            Assert.IsFalse(coroutineContext.IsFinished);

            bool isPausedEventTriggered = false;
            coroutineContext.Paused += paused => isPausedEventTriggered = paused;

            var pausingThread = new Thread(() =>
                {   
                    Thread.Sleep(10);
                    coroutineContext.Pause();
                });

            pausingThread.Start();
            coroutineContext.Start();

            Assert.IsTrue(isPausedEventTriggered);
            Assert.IsTrue(coroutineContext.IsStarted);
            Assert.IsTrue(coroutineContext.IsPaused);
            Assert.IsFalse(coroutineContext.IsFinished);

            var testUnpausedThread = new Thread(() =>
                {
                    Thread.Sleep(10);

                    Assert.IsTrue(coroutineContext.IsStarted);
                    Assert.IsFalse(coroutineContext.IsPaused);
                    Assert.IsFalse(coroutineContext.IsFinished);

                    coroutineContext.Stop();
                });

            testUnpausedThread.Start();

            coroutineContext.Unpause();
        }