예제 #1
0
        public void TestWriteToBytes()
        {
            IntegerField field = new IntegerField(0);

            byte[] array = new byte[4];

            for (int j = 0; j < _test_array.Length; j++)
            {
                field.Value = _test_array[j];
                field.WriteToBytes(array);
                int val = array[3] << 24;

                val &= unchecked ((int)0xFF000000);
                val += (array[2] << 16) & 0x00FF0000;
                val += (array[1] << 8) & 0x0000FF00;
                val += (array[0] & 0x000000FF);
                Assert.AreEqual(_test_array[j], val, "testing ");
            }
        }