Пример #1
0
        public void EncodeTest()
        {
            var       packer = new TextPacker();
            Exception ex;
            var       data = packer.Encode(Encoding.Default.GetBytes("helloworld"), out ex);

            Assert.AreEqual("helloworld\n", Encoding.Default.GetString((byte[])data));
        }
Пример #2
0
        public void TestEncodeNullData()
        {
            var       packer = new TextPacker();
            Exception ex;
            var       data = packer.Encode(null, out ex);

            Assert.AreEqual(null, data);
            Assert.AreNotEqual(null, ex);
        }
Пример #3
0
        public void MulDataInput()
        {
            var       packer = new TextPacker();
            Exception ex;
            var       data = packer.Input(Encoding.Default.GetBytes("hello"), out ex);

            Assert.AreEqual(0, data);
            data = packer.Input(Encoding.Default.GetBytes("helloworld\n"), out ex);
            Assert.AreEqual(11, data);
        }
Пример #4
0
        public void InputTests()
        {
            var       packer = new TextPacker();
            Exception ex;
            var       length = packer.Input(Encoding.Default.GetBytes("hello\nworld"), out ex);

            Assert.AreEqual(6, length);

            length = packer.Input(Encoding.Default.GetBytes("helloworld"), out ex);
            Assert.AreEqual(0, length);
        }