Exemple #1
0
        public void TestInit()
        {
            Stream      baseStream = new MemoryStream();
            GZipStream  gzipStream = new GZipStream(baseStream, CompressionMode.Decompress);

            Assert.AreSame(baseStream, gzipStream.BaseStream);

            gzipStream.Close();
        }
Exemple #2
0
        public void TestDecompress()
        {
            Stream      baseStream = new MemoryStream(this.compressedData);
            GZipStream  gzipStream = new GZipStream(baseStream, CompressionMode.Decompress);

            StreamReader reader = new StreamReader(gzipStream);

            string  data = reader.ReadToEnd();

            Assert.AreEqual(Data, data);

            gzipStream.Close();
        }
Exemple #3
0
        public void TestProperties()
        {
            Stream      baseStream = new MemoryStream(this.compressedData);
            GZipStream  gzipStream = new GZipStream(baseStream, CompressionMode.Decompress);

            Assert.IsTrue(gzipStream.CanRead);
            Assert.IsFalse(gzipStream.CanWrite);
            Assert.IsFalse(gzipStream.CanSeek);

            try { long i = gzipStream.Length; }
            catch (NotSupportedException) {}

            try { long i = gzipStream.Position; }
            catch (NotSupportedException) {}

            try { gzipStream.Position = 0; }
            catch (NotSupportedException) {}
        }
Exemple #4
0
        public void TestNotSupported()
        {
            Stream      baseStream = new MemoryStream(this.compressedData);
            GZipStream  gzipStream = new GZipStream(baseStream, CompressionMode.Decompress);

            try { gzipStream.Write(null, 0, 0); }
            catch (NotSupportedException) {}

            try { gzipStream.Flush(); }
            catch (NotSupportedException) {}

            try { gzipStream.Seek(0, SeekOrigin.Begin); }
            catch (NotSupportedException) {}

            try { gzipStream.SetLength(0); }
            catch (NotSupportedException) {}
        }
Exemple #5
0
 public void TestDestructor()
 {
     using (GZipStream stream = new GZipStream(new MemoryStream(), CompressionMode.Decompress))
     {
     }
 }