Пример #1
0
 /// <inheritdoc/>
 protected void Dispose(bool disposing)
 {
     if (disposing)
     {
         RequestScope?.Dispose();
     }
 }
Пример #2
0
        public void Dispose_EnsureDisposed()
        {
            RequestScope scope = new RequestScope();

            scope.Dispose();
            Assert.Null(RequestScope.Current);
        }
Пример #3
0
        public void Dispose_EnsureDisposedInChildThread()
        {
            RequestScope scope = new RequestScope();

            scope.Dispose();

            Task.Run(
                () =>
            {
                Assert.Null(RequestScope.Current);
            }).GetAwaiter().GetResult();
        }
Пример #4
0
        public void Create_EnsureCurrent()
        {
            RequestScope scope = new RequestScope();

            try
            {
                Assert.Equal(RequestScope.Current, scope);
            }
            finally
            {
                scope.Dispose();
            }
        }
Пример #5
0
        public void Create_EnsureCurrentInChildThread()
        {
            RequestScope scope = new RequestScope();

            try
            {
                Task.Run(
                    () =>
                {
                    Assert.Equal(RequestScope.Current, scope);
                }).GetAwaiter().GetResult();
            }
            finally
            {
                scope.Dispose();
            }
        }