public void ToSByte_SByteOverloadValueAndLengthInstanceIsNull_ThrowsArgumentNullException() { IBitCharger instance = null; Int32 offset = 42; Assert.That(() => instance.ToSByte(offset), Throws.ArgumentNullException); }
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)); }
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)); }
/// <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)); }
public void ToSByte_SByteOverloadOnlyValueInstanceIsNull_ThrowsArgumentNullException() { IBitCharger instance = null; Assert.That(() => instance.ToSByte(), Throws.ArgumentNullException); }