public void It_should_convert_short_to_binary_and_from_binary_to_short_with_the_success()
        {
            const short value = 12345;

            var byteArray      = ByteArrayConverter.ShortToByteArray(value);
            var convertedValue = ByteArrayConverter.ByteArrayToShort(byteArray);

            Assert.That(convertedValue, Is.EqualTo(value));
        }
Esempio n. 2
0
        public virtual void TestShort()
        {
            short s  = 4598;
            var   b2 = ByteArrayConverter.ShortToByteArray(s);
            var   s2 = ByteArrayConverter.ByteArrayToShort(b2);

            // assertEquals(s,s2);
            s  = 10000;
            b2 = ByteArrayConverter.ShortToByteArray(s);
            s2 = ByteArrayConverter.ByteArrayToShort(b2);
            AssertEquals(s, s2);
            s  = short.MaxValue;
            b2 = ByteArrayConverter.ShortToByteArray(s);
            s2 = ByteArrayConverter.ByteArrayToShort(b2);
            AssertEquals(s, s2);
            s  = short.MinValue;
            b2 = ByteArrayConverter.ShortToByteArray(s);
            s2 = ByteArrayConverter.ByteArrayToShort(b2);
            AssertEquals(s, s2);
        }