File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,30 @@ private static byte[] GetRandomBuffer(int length)
4040 return input ;
4141 }
4242
43+ [ Theory ]
44+ [ MemberData ( nameof ( Compressors ) , 1 ) ]
45+ #pragma warning disable xUnit1026 // Theory methods should use all of their parameters
46+ public void DisposedCompressorThrows ( Compressor compressor , ReadOnlyMemory < byte > input , BclInflater _ )
47+ #pragma warning restore xUnit1026 // Theory methods should use all of their parameters
48+ {
49+ using ( compressor )
50+ {
51+ //make sure we don't throw when not disposed
52+ Compress ( ) ;
53+ }
54+
55+ Assert . Throws < ObjectDisposedException > ( Compress ) ;
56+
57+ void Compress ( )
58+ {
59+ ReadOnlySpan < byte > inSpan = input . Span ;
60+ using var outputOwner = compressor . Compress ( inSpan ) ;
61+
62+ Span < byte > output = new byte [ input . Length ] ;
63+ compressor . Compress ( inSpan , output ) ;
64+ }
65+ }
66+
4367 [ Theory ]
4468 [ MemberData ( nameof ( AllCompressors ) ) ]
4569 public void CompressOwnedBufferTest ( Compressor compressor , ReadOnlyMemory < byte > input , BclInflater bclInflater )
You can’t perform that action at this time.
0 commit comments