Пример #1
0
        public void Test_ToInt32()
        {
            var        converter = new DefaultConverter();
            var        actual    = converter.ToInt32(_buffer, 8);
            const uint expected  = 5u;

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void Test_ToInt32_NoNboSpecified(int value)
        {
            var converter = new DefaultConverter();

            var bytes = BitConverter.GetBytes(value);

            bytes = bytes.Reverse().ToArray();

            var actual = converter.ToInt32(bytes.AsSpan());

            Assert.Equal(value, actual);
        }
Пример #3
0
        public void Test_ToInt32(int value, bool useNbo)
        {
            var converter = new DefaultConverter();

            var bytes = BitConverter.GetBytes(value);

            if (useNbo)
            {
                bytes = bytes.Reverse().ToArray();
            }

            var actual = converter.ToInt32(bytes.AsSpan(), useNbo);

            Assert.Equal(value, actual);
        }