public void Add_Throws_Error_When_Called_After_Dispose() { using (var instance = new PpcBuffer <object>(ConcurrentBuffer.Unbounded, CancellationToken.None)) { instance.Dispose(); Assert.Throws <NullReferenceException>(() => instance.Add(new object(), CancellationToken.None)); } }
public void TryGet_Throws_Error_After_Dispose() { using (var instance = new PpcBuffer <object>(ConcurrentBuffer.Unbounded, CancellationToken.None)) { instance.Dispose(); Assert.Throws <NullReferenceException>(() => instance.TryGet(Timeout.Infinite, CancellationToken.None, out var _)); } }
public async Task Add_Throws_Error_When_Called_After_Dispose() { var instance = new PpcBuffer <object>(ConcurrentBuffer.Unbounded, CancellationToken.None); #if !NETFRAMEWORK await instance.DisposeAsync().ConfigureAwait(false); #else instance.Dispose(); #endif Assert.Throws <NullReferenceException>(() => instance.Add(new object(), CancellationToken.None)); await Task.CompletedTask; }
public async Task TryGet_Throws_Error_After_Dispose() { var instance = new PpcBuffer <object>(ConcurrentBuffer.Unbounded, CancellationToken.None); #if !NETFRAMEWORK && !NETCOREAPP2_2 await using (instance.ConfigureAwait(false)) #else using (instance) #endif { instance.Dispose(); Assert.Throws <NullReferenceException>(() => instance.TryGet(Timeout.Infinite, CancellationToken.None, out _)); } await Task.CompletedTask; }