Decode() public method

Decodes the specified value.
public Decode ( byte value ) : byte[]
value byte The byte array to decode.
return byte[]
Esempio n. 1
0
        public void Decode_WithNull_ReturnsNull()
        {
            var encoding = new ContentEncoder("gzip");
            var nullBytes = encoding.Decode(null);

            Assert.IsNull(nullBytes);
        }
Esempio n. 2
0
        public void Decode_WithNull_ReturnsNull()
        {
            var encoding  = new ContentEncoder("gzip");
            var nullBytes = encoding.Decode(null);

            Assert.IsNull(nullBytes);
        }
Esempio n. 3
0
        public void Decode_UsingUnknownMethod_ReturnsSame()
        {
            var encoding = new ContentEncoder("badmethod");
            var actual   = encoding.Decode(_helloWorldGZip);

            CollectionAssert.AreEqual(_helloWorldGZip, actual);
        }
Esempio n. 4
0
        public void Decode_UsingGzip_ReturnsDecompressed()
        {
            var encoding = new ContentEncoder("gzip");
            var actual   = encoding.Decode(_helloWorldGZip);

            CollectionAssert.AreEqual(_helloWorldUtf8, actual);
        }
Esempio n. 5
0
        public void Decode_UsingDeflate_ReturnsDecompressed()
        {
            var encoding = new ContentEncoder("deflate");
            var actual   = encoding.Decode(_helloWorldDeflate);

            CollectionAssert.AreEqual(_helloWorldUtf8, actual);
        }
Esempio n. 6
0
        public void Encode_UsingDeflate_ReturnsCompressed()
        {
            var encoding = new ContentEncoder("deflate");
            var actual   = encoding.Encode(_helloWorldUtf8);

            // assert that we got back something different
            CollectionAssert.AreNotEqual(_helloWorldUtf8, actual);

            var roundTrip = encoding.Decode(actual);

            CollectionAssert.AreEqual(_helloWorldUtf8, roundTrip);
        }
Esempio n. 7
0
        public void Encode_UsingGzip_ReturnsCompressed()
        {
            var encoding = new ContentEncoder("gzip");
            var actual   = encoding.Encode(_helloWorldUtf8);

            CollectionAssert.AreNotEqual(_helloWorldUtf8, actual);

            // assert that the gzip header is present
            Assert.AreEqual(actual[0], 31);
            Assert.AreEqual(actual[1], 139);

            var roundTrip = encoding.Decode(actual);

            CollectionAssert.AreEqual(_helloWorldUtf8, roundTrip);
        }
Esempio n. 8
0
        public void Encode_UsingGzipUppercase_ReturnsCompressed()
        {
            var encoding = new ContentEncoder("GZIP");
            var actual = encoding.Encode(_helloWorldUtf8);

            // assert that we got back something different
            CollectionAssert.AreNotEqual(_helloWorldUtf8, actual);

            // assert that the gzip header is present
            Assert.AreEqual(actual[0], 31);
            Assert.AreEqual(actual[1], 139);

            var roundTrip = encoding.Decode(actual);
            CollectionAssert.AreEqual(_helloWorldUtf8, roundTrip);
        }
Esempio n. 9
0
        public void Encode_UsingDeflate_ReturnsCompressed()
        {
            var encoding = new ContentEncoder("deflate");
            var actual = encoding.Encode(_helloWorldUtf8);

            // assert that we got back something different
            CollectionAssert.AreNotEqual(_helloWorldUtf8, actual);

            var roundTrip = encoding.Decode(actual);

            CollectionAssert.AreEqual(_helloWorldUtf8, roundTrip);
        }
Esempio n. 10
0
 public void Decode_UsingUnknownMethod_ReturnsSame()
 {
     var encoding = new ContentEncoder("badmethod");
     var actual = encoding.Decode(_helloWorldGZip);
     CollectionAssert.AreEqual(_helloWorldGZip, actual);
 }
Esempio n. 11
0
 public void Decode_UsingGzip_ReturnsDecompressed()
 {
     var encoding = new ContentEncoder("gzip");
     var actual = encoding.Decode(_helloWorldGZip);
     CollectionAssert.AreEqual(_helloWorldUtf8, actual);
 }
Esempio n. 12
0
 public void Decode_UsingDeflate_ReturnsDecompressed()
 {
     var encoding = new ContentEncoder("deflate");
     var actual = encoding.Decode(_helloWorldDeflate);
     CollectionAssert.AreEqual(_helloWorldUtf8, actual);
 }