public void ToInt16_Int16OverloadValueAndLengthInstanceIsNull_ThrowsArgumentNullException() { IBitCharger instance = null; Int32 offset = 42; Assert.That(() => instance.ToInt16(offset), Throws.ArgumentNullException); }
public void ToInt16_OnlyValue_ResultAsExpected() { IBitCharger instance = this.CreateInstance(); Int16 expected = 4711; // LE: 0x6712 => 01100111 00010010 Byte[] array = new Byte[] { 0x67, 0x12 }; instance.SetBytes(array); Assert.That(instance.ToInt16(), Is.EqualTo(expected)); }
public void ToInt16_ValueAndOffset_ResultAsExpected() { IBitCharger instance = this.CreateInstance(); Int16 expected = 4711; // LE: 0x6712 => 01100111 00010010 Int32 offset = 2; Byte[] array = new Byte[] { 0x67, 0x12 }; instance.SetBytes(array, offset); Assert.That(instance.ToInt16(offset), Is.EqualTo(expected)); }
/// <summary> /// Gets all bytes from the charger and converts them into /// <see cref="Int16"/>. /// </summary> /// <remarks> /// This method gets all bytes from the charger and converts /// them into <see cref="Int16"/>. /// </remarks> /// <param name="charger"> /// An instance of <see cref="IBitCharger"/> to set the bits /// </param> /// <returns> /// A value of type <see cref="Int16"/> representing all applied /// bits. /// </returns> public static Int16 ToInt16(this IBitCharger charger) { return(charger.ToInt16(0)); }
public void ToInt16_Int16OverloadOnlyValueInstanceIsNull_ThrowsArgumentNullException() { IBitCharger instance = null; Assert.That(() => instance.ToInt16(), Throws.ArgumentNullException); }