public void TestLSBArray() { int data = 0xFFAB; var result = ByteExtensions.GetLSBArrayFromValue(data, 2); Assert.IsTrue(result[0] == 0xAB); Assert.IsTrue(result[1] == 0xFF); Assert.IsTrue(ByteExtensions.GetValueFromLSBArray(result) == data); data = 0xABCDEF; result = ByteExtensions.GetLSBArrayFromValue(data, 2); Assert.IsTrue(result[0] == 0xEF); Assert.IsTrue(result[1] == 0xCD); Assert.IsTrue(ByteExtensions.GetValueFromLSBArray(result) == 0xCDEF); result = ByteExtensions.GetLSBArrayFromValue(data); Assert.IsTrue(result[0] == 0xEF); Assert.IsTrue(result[1] == 0xCD); Assert.IsTrue(result[2] == 0xAB); Assert.IsTrue(ByteExtensions.GetValueFromLSBArray(result) == data); Assert.IsTrue(ByteExtensions.GetValueFromLSBArray(result, 1, 2) == 0xABCD); Assert.IsTrue(ByteExtensions.GetValueFromLSBArray(result, 2, 2) == 0xAB); }