Beispiel #1
0
        public void ToInt32_Int32OverloadValueAndLengthInstanceIsNull_ThrowsArgumentNullException()
        {
            IBitCharger instance = null;

            Int32 offset = 42;

            Assert.That(() => instance.ToInt32(offset), Throws.ArgumentNullException);
        }
Beispiel #2
0
        public void ToInt32_OnlyValue_ResultAsExpected()
        {
            IBitCharger instance = this.CreateInstance();

            Int32 expected = 47110815; // LE: 0x9FDACE02 => 10011111 11011010 11001110 00000010

            Byte[] array = new Byte[] { 0x9F, 0xDA, 0xCE, 0x02 };

            instance.SetBytes(array);

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

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