Ejemplo n.º 1
0
        public void CacheEncodeTest()
        {
            var encoderDecoder = new XorEncoderDecoder("abc");

            this.cache.Encoder = encoderDecoder;
            this.cache.Decoder = encoderDecoder;
            this.cache.SetCache("foo", System.Text.UTF8Encoding.UTF8.GetBytes("foobar"));
            Assert.AreEqual(System.Text.UTF8Encoding.UTF8.GetBytes("foobar"), this.cache.GetCache("foo"));
        }
Ejemplo n.º 2
0
        public void EncodeDecodeTest()
        {
            var encoderDecoder = new XorEncoderDecoder(new byte[] { 0x01 });

            Assert.AreEqual(new byte[] { }, encoderDecoder.Decode(encoderDecoder.Encode(new byte[] { })));
            Assert.AreEqual(new byte[] { 0x00 }, encoderDecoder.Decode(encoderDecoder.Encode(new byte[] { 0x00 })));
            Assert.AreEqual(new byte[] { 0xFF, 0x01 },
                            encoderDecoder.Decode(encoderDecoder.Encode(new byte[] { 0xFF, 0x01 })));
        }