Esempio n. 1
0
        public async Task WithNewContextResultToken()
        {
            AsyncContext.Ensure();
            var id = AsyncContext.CurrentContext.Id;

            var idx = await ValueTaskEx.WithNewContext(token =>
                                                       new ValueTask <long>(AsyncContext.CurrentContext.Id), CancellationToken.None);

            Assert.That(idx, Is.Not.EqualTo(id));
        }
Esempio n. 2
0
        public async Task WithNewContextResult()
        {
            AsyncContext.Ensure();
            var id = AsyncContext.CurrentContext.Id;

            var idx = await ValueTaskEx.WithNewContext(() =>
                                                       new ValueTask <long>(AsyncContext.CurrentContext.Id));

            Assert.That(idx, Is.Not.EqualTo(id));
        }
Esempio n. 3
0
        public async Task WithNewContextToken()
        {
            AsyncContext.Ensure();
            var id = AsyncContext.CurrentContext.Id;

            long idx = -1;
            await ValueTaskEx.WithNewContext(token =>
            {
                idx = AsyncContext.CurrentContext.Id;
                return(new ValueTask());
            }, CancellationToken.None);

            Assert.That(idx, Is.Not.EqualTo(id));
        }
Esempio n. 4
0
        public async Task WithNewContext()
        {
            AsyncContext.Ensure();
            var id = AsyncContext.CurrentContext.Id;

            long idx = -1;
            await ValueTaskEx.WithNewContext(() =>
            {
                idx = AsyncContext.CurrentContext.Id;
                return(new ValueTask());
            });

            Assert.That(idx, Is.Not.EqualTo(id));
        }