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)); }
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)); }
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)); }
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)); }