Ejemplo n.º 1
0
        public void DecodeByteString_NotEnoughBytesInInput_Exception()
        {
            var input = "100:12345";
            var inputStream = new MemoryStream(Encoding.ASCII.GetBytes(input), false);

            var transform = new ByteStringTransform();
            var bstrObj = transform.Decode(inputStream);
        }
Ejemplo n.º 2
0
        public void DecodeByteString_InsaneByteStringLength_Exception()
        {
            var input = "12345678901234567890:123";
            var inputStream = new MemoryStream(Encoding.ASCII.GetBytes(input), false);

            var transform = new ByteStringTransform();
            var bstrObj = transform.Decode(inputStream);
        }
Ejemplo n.º 3
0
        public void DecodeByteString_NoBytesInInput_Positive()
        {
            var inputStream = new MemoryStream(new byte[] { 48, 58 }, false);       // "0:"

            var transform = new ByteStringTransform();
            var bstrObj = transform.Decode(inputStream);

            Assert.AreEqual<long>(0L, bstrObj.Value.Length);
        }
Ejemplo n.º 4
0
        public void DecodeByteString_SimpleScenario_Positive()
        {
            var inputStream = new MemoryStream(new byte[] { 52, 58, 49, 50, 51, 52 }, false);       // "4:1234"
            var expectedOutput = new byte[] { 49, 50, 51, 52 };

            var transform = new ByteStringTransform();
            var bstrObj = transform.Decode(inputStream);

            Assert.IsTrue(expectedOutput.IsEqualWith(bstrObj.Value), "Outputted bytes are different than expected");
        }
Ejemplo n.º 5
0
 public void DecodeByteString_NullInputStream_Exception()
 {
     var transform = new ByteStringTransform();
     var bstrObj = transform.Decode(null);
 }