UnpackUInt64() private method

private UnpackUInt64 ( Stream source ) : System.UInt64
source Stream
return System.UInt64
Ejemplo n.º 1
0
        private static void TestUInt64(UInt64 value)
        {
            var output = new MemoryStream();

            Packer.Create(output).Pack(value);
            Assert.AreEqual(value, Unpacking.UnpackUInt64(new MemoryStream(output.ToArray())));
            Assert.AreEqual(value, Unpacking.UnpackUInt64(output.ToArray()).Value);
        }
Ejemplo n.º 2
0
        public void TestUnpackUInt16MaxValue_UnpackUInt64_ByteArray()
        {
            var buffer = new byte[] { 0xCD, 0xFF, 0xFF };
            var result = Unpacking.UnpackUInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(65535));
        }
Ejemplo n.º 3
0
        public void TestUnpackUInt64MaxValue_UnpackUInt64_ByteArray()
        {
            var buffer = new byte[] { 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
            var result = Unpacking.UnpackUInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(18446744073709551615));
        }
Ejemplo n.º 4
0
        public void TestUnpackUInt32MaxValuePlusOne_UnpackUInt64_ByteArray()
        {
            var buffer = new byte[] { 0xCF, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0 };
            var result = Unpacking.UnpackUInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(4294967296));
        }
Ejemplo n.º 5
0
        public void TestUnpackPositiveFixNumMaxValuePlusOne_UnpackUInt64_ByteArray()
        {
            var buffer = new byte[] { 0xCC, 0x80 };
            var result = Unpacking.UnpackUInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(128));
        }
Ejemplo n.º 6
0
        public void TestUnpackPlusOne_UnpackUInt64_ByteArray()
        {
            var buffer = new byte[] { 0x1 };
            var result = Unpacking.UnpackUInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(1));
        }
Ejemplo n.º 7
0
 public void TestUnpackUInt64MaxValue_UnpackUInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }))
     {
         var result = Unpacking.UnpackUInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(18446744073709551615));
     }
 }
Ejemplo n.º 8
0
 public void TestUnpackUInt32MaxValuePlusOne_UnpackUInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0xCF, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0 }))
     {
         var result = Unpacking.UnpackUInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(4294967296));
     }
 }
Ejemplo n.º 9
0
 public void TestUnpackPositiveFixNumMaxValuePlusOne_UnpackUInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0xCC, 0x80 }))
     {
         var result = Unpacking.UnpackUInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(128));
     }
 }
Ejemplo n.º 10
0
 public void TestUnpackZero_UnpackUInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0x0 }))
     {
         var result = Unpacking.UnpackUInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(0));
     }
 }