Example #1
0
        public void ToSByte_SByteOverloadValueAndLengthInstanceIsNull_ThrowsArgumentNullException()
        {
            IBitCharger instance = null;

            Int32 offset = 42;

            Assert.That(() => instance.ToSByte(offset), Throws.ArgumentNullException);
        }
Example #2
0
        public void ToSByte_OnlyValue_ResultAsExpected()
        {
            IBitCharger instance = this.CreateInstance();

            SByte expected = 42; // LE: 0x2A => 00101010

            Byte[] array = new Byte[] { 0x2A };

            instance.SetBytes(array);

            Assert.That(instance.ToSByte(), Is.EqualTo(expected));
        }
Example #3
0
        public void ToSByte_ValueAndOffset_ResultAsExpected()
        {
            IBitCharger instance = this.CreateInstance();

            SByte expected = 42; // LE: 0x2A => 00101010
            Int32 offset   = 2;

            Byte[] array = new Byte[] { 0x2A };

            instance.SetBytes(array, offset);

            Assert.That(instance.ToSByte(offset), Is.EqualTo(expected));
        }
Example #4
0
 /// <summary>
 /// Gets all bytes from the charger and converts them into
 /// <see cref="SByte"/>.
 /// </summary>
 /// <remarks>
 /// This method gets all bytes from the charger and converts
 /// them into <see cref="SByte"/>.
 /// </remarks>
 /// <param name="charger">
 /// An instance of <see cref="IBitCharger"/> to set the bits
 /// </param>
 /// <returns>
 /// A value of type <see cref="SByte"/> representing all applied
 /// bits.
 /// </returns>
 public static SByte ToSByte(this IBitCharger charger)
 {
     return(charger.ToSByte(0));
 }
Example #5
0
        public void ToSByte_SByteOverloadOnlyValueInstanceIsNull_ThrowsArgumentNullException()
        {
            IBitCharger instance = null;

            Assert.That(() => instance.ToSByte(), Throws.ArgumentNullException);
        }