Esempio n. 1
0
        public async Task middleware_yielding_same_thread()
        {
            var didItYield = await InvokeUntil <CodeMiddleware>(
                new YieldBefore <CodeMiddleware>(),
                new CodeMiddleware(() => Resumed = true));

            didItYield.ShouldBeTrue();
            Resumed.ShouldBeFalse();

            await Resume <CodeMiddleware>();

            Resumed.ShouldBeTrue();
        }
Esempio n. 2
0
        public async Task middleware_yielding_before_code_on_other_thread()
        {
            var didItYield = await InvokeUntil <OtherThreadMiddleware>(
                new YieldBefore <OtherThreadMiddleware>(),
                new OtherThreadMiddleware(),
                new CodeMiddleware(() => Resumed = true)
                );


            didItYield.ShouldBeTrue();
            Resumed.ShouldBeFalse();

            await Resume <OtherThreadMiddleware>();

            Resumed.ShouldBeTrue();
        }