public void EncodeByteString_SimpleScenario_Positive()
        {
            // Prepare input and expected output value
            byte[] inputBytes = {1,2,3,4};

            byte[] expectedBytes = {0,0,1,2,3,4};
            expectedBytes[0] = EncodingHelper.GetASCIIValue('4');
            expectedBytes[1] = EncodingHelper.GetASCIIValue(':');

            MemoryStream outputStream = new MemoryStream(6);

            // Do encoding
            BByteString bstrObj = new BByteString()
            {
                Value = inputBytes
            };

            var transform = new ByteStringTransform();
            transform.Encode(bstrObj, outputStream);

            // Check results
            Assert.AreEqual<long>(expectedBytes.LongLength, outputStream.Position);         // Ensure 6 bytes were (likely) written

            outputStream.Position = 0;
            byte[] outputtedBytes = outputStream.ToArray();

            Assert.IsTrue(outputtedBytes.IsEqualWith(expectedBytes), "Outputted bytes are different than expected");
        }
        public void EncodeByteString_NullInputObject_Exception()
        {
            MemoryStream outputStream = new MemoryStream();

            var transform = new ByteStringTransform();
            transform.Encode(null, outputStream);
        }
        public void EncodeByteString_NullOutputStream_Exception()
        {
            BByteString bstrObj = new BByteString()
            {
                Value = new byte[] { }
            };

            var transform = new ByteStringTransform();
            transform.Encode(bstrObj, null);
        }
        public void EncodeByteString_NoBytesInInput_Positive()
        {
            // Prepare input and expected output value
            byte[] inputBytes = { };

            byte[] expectedBytes = { 0, 0 };
            expectedBytes[0] = EncodingHelper.GetASCIIValue('0');
            expectedBytes[1] = EncodingHelper.GetASCIIValue(':');

            MemoryStream outputStream = new MemoryStream(6);

            // Do encoding
            BByteString bstrObj = new BByteString()
            {
                Value = inputBytes
            };

            var transform = new ByteStringTransform();
            transform.Encode(bstrObj, outputStream);

            // Check results
            outputStream.Position = 0;
            byte[] outputtedBytes = outputStream.ToArray();

            Assert.IsTrue(outputtedBytes.IsEqualWith(expectedBytes), "Outputted bytes are different than expected");
        }