Ejemplo n.º 1
0
        public void ToByte_ByteOverloadValueAndLengthInstanceIsNull_ThrowsArgumentNullException()
        {
            IBitCharger instance = null;

            Int32 offset = 42;

            Assert.That(() => instance.ToByte(offset), Throws.ArgumentNullException);
        }
Ejemplo n.º 2
0
        public void ToByte_OnlyValue_ResultAsExpected()
        {
            IBitCharger instance = this.CreateInstance();

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

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

            instance.SetBytes(array);

            Assert.That(instance.ToByte(), Is.EqualTo(expected));
        }
Ejemplo n.º 3
0
        public void ToByte_ValueAndOffset_ResultAsExpected()
        {
            IBitCharger instance = this.CreateInstance();

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

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

            instance.SetBytes(array, offset);

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

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