Beispiel #1
0
        public void WhenValueIsZero_ShouldReturnInteger( )
        {
            var fixture = new Fixture( );
            var value   = 0;
            var offset  = fixture.Create <int> ( );
            var dest    = new byte[offset + 4];

            Assert.True(offset >= 0);
            ManagedAdbExtenstions.Swap32bitsToArray(value, dest, offset);

            var result = ManagedAdbExtenstions.Swap32bitFromArray(dest, offset);

            Assert.Equal(value, result);
        }
Beispiel #2
0
        public void WhenValueIsZero_ShouldReturnSwapped( )
        {
            var fixture = new Fixture( );
            var value   = 0;
            var offset  = fixture.Create <int> ( );
            var dest    = new byte[offset + 4];

            Assert.True(offset >= 0);

            ManagedAdbExtenstions.Swap32bitsToArray(value, dest, offset);
            Assert.True(dest.Length == offset + 4);
            Assert.True(dest[offset] == (byte)(value & 0x000000FF));
            Assert.True(dest[offset + 1] == (byte)(value & 0x0000FF00) >> 8);
            Assert.True(dest[offset + 2] == (byte)(value & 0x00FF0000) >> 16);
            Assert.True(dest[offset + 3] == (byte)(value & 0xFF000000) >> 24);
        }