Extensions.cs Unit Tests
This class contains all of the extension methods used by Rhyduino.
A line through the test indicates that it has been written and checked in to the source repository.
Extensions.ToHexString(this byte value)
- Formats a byte array into an easily readable string of hex bytes.
Extensions.ToTwo7BitBytes(this int value)
Verify that a null value generates an ArgumentNullException Verify that the string it generates is the one expected for the input data.
- This function takes an integer and formats it as two 7-bit bytes (the format used by Firmata for sending numerical data).
Extensions.Trim(this byte value)
Verify that it converts the values correctly using values at the boundaries, near the boundaries, and in the middle of the range.
- This function removes trailing null bytes from a byte array.
Verify that a null value generates an ArgumentNullException Verify that it performs as expected (it only removes null bytes from the end of the array).
Verify that it does nothing when called from an empty array.