/// <inheritdoc/> protected void Dispose(bool disposing) { if (disposing) { RequestScope?.Dispose(); } }
public void Dispose_EnsureDisposed() { RequestScope scope = new RequestScope(); scope.Dispose(); Assert.Null(RequestScope.Current); }
public void Dispose_EnsureDisposedInChildThread() { RequestScope scope = new RequestScope(); scope.Dispose(); Task.Run( () => { Assert.Null(RequestScope.Current); }).GetAwaiter().GetResult(); }
public void Create_EnsureCurrent() { RequestScope scope = new RequestScope(); try { Assert.Equal(RequestScope.Current, scope); } finally { scope.Dispose(); } }
public void Create_EnsureCurrentInChildThread() { RequestScope scope = new RequestScope(); try { Task.Run( () => { Assert.Equal(RequestScope.Current, scope); }).GetAwaiter().GetResult(); } finally { scope.Dispose(); } }