本文整理汇总了C#中MsgPack.ItemsUnpacker.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# ItemsUnpacker.Skip方法的具体用法?C# ItemsUnpacker.Skip怎么用?C# ItemsUnpacker.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MsgPack.ItemsUnpacker
的用法示例。
在下文中一共展示了ItemsUnpacker.Skip方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSkip_FalseValue
public void TestSkip_FalseValue()
{
var binary = new byte[]{ 0xC2, 0xC2 };
using ( var buffer = new MemoryStream( binary ) )
using ( var target = new ItemsUnpacker( buffer, PackerUnpackerStreamOptions.None ) )
{
var result = target.Skip();
Assert.That( result, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
Assert.That( buffer.Position, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
// Verify centinel value still exists in the stream.
Assert.That( buffer.ReadByte(), Is.EqualTo( 0xC2 ) );
}
}
示例2: TestSkip_Ext16_Zero
public void TestSkip_Ext16_Zero()
{
var binary = new byte[] { 0xC8 }.Concat( BitConverter.GetBytes( ( ushort )0x0 ).Reverse() ).Concat( new byte[] { 0x7F } ).Concat( new byte[] { 0xC2 } ).ToArray();
using ( var buffer = new MemoryStream( binary ) )
using ( var target = new ItemsUnpacker( buffer, PackerUnpackerStreamOptions.None ) )
{
var result = target.Skip();
Assert.That( result, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
Assert.That( buffer.Position, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
// Verify centinel value still exists in the stream.
Assert.That( buffer.ReadByte(), Is.EqualTo( 0xC2 ) );
}
}
示例3: TestSkip_Ext8_Max
public void TestSkip_Ext8_Max()
{
var binary = new byte[] { 0xC7 }.Concat( new byte[] { 0xFF } ).Concat( new byte[] { 0x7F } ).Concat( Enumerable.Repeat( 0x41, 0xFF ).Select( i => ( byte )i ) ).Concat( new byte[] { 0xC2 } ).ToArray();
using ( var buffer = new MemoryStream( binary ) )
using ( var target = new ItemsUnpacker( buffer, PackerUnpackerStreamOptions.None ) )
{
var result = target.Skip();
Assert.That( result, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
Assert.That( buffer.Position, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
// Verify centinel value still exists in the stream.
Assert.That( buffer.ReadByte(), Is.EqualTo( 0xC2 ) );
}
}
示例4: TestSkip_FixExt16
public void TestSkip_FixExt16()
{
var binary = new byte[]{ 0xD8, 0x7F, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0xC2 };
using ( var buffer = new MemoryStream( binary ) )
using ( var target = new ItemsUnpacker( buffer, PackerUnpackerStreamOptions.None ) )
{
var result = target.Skip();
Assert.That( result, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
Assert.That( buffer.Position, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
// Verify centinel value still exists in the stream.
Assert.That( buffer.ReadByte(), Is.EqualTo( 0xC2 ) );
}
}
示例5: TestExt8_Zero
public void TestExt8_Zero()
{
var binary = new byte[] { 0xC7 }.Concat( new byte[] { 0x0 } ).Concat( new byte[] { 0x7F } ).Concat( new byte[] { 0xC2 } ).ToArray();
using ( var buffer = new MemoryStream( binary ) )
using ( var target = new ItemsUnpacker( buffer, false ) )
{
var result = target.Skip();
Assert.That( result, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
Assert.That( buffer.Position, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
// Verify centinel value still exists in the stream.
Assert.That( buffer.ReadByte(), Is.EqualTo( 0xC2 ) );
}
}
示例6: TestBin32_Max
public void TestBin32_Max()
{
var binary = new byte[] { 0xC6 }.Concat( BitConverter.GetBytes( ( uint )0x10001 ).Reverse() ).Concat( Enumerable.Repeat( 0x41, 0x10001 ).Select( i => ( byte )i ) ).Concat( new byte[] { 0xC2 } ).ToArray();
using ( var buffer = new MemoryStream( binary ) )
using ( var target = new ItemsUnpacker( buffer, false ) )
{
var result = target.Skip();
Assert.That( result, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
Assert.That( buffer.Position, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
// Verify centinel value still exists in the stream.
Assert.That( buffer.ReadByte(), Is.EqualTo( 0xC2 ) );
}
}
示例7: TestFixExt4
public void TestFixExt4()
{
var binary = new byte[]{ 0xD6, 0x7F, 0x04, 0x03, 0x02, 0x01, 0xC2 };
using ( var buffer = new MemoryStream( binary ) )
using ( var target = new ItemsUnpacker( buffer, false ) )
{
var result = target.Skip();
Assert.That( result, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
Assert.That( buffer.Position, Is.EqualTo( binary.Length - 1 /* minus centinel byte */ ) );
// Verify centinel value still exists in the stream.
Assert.That( buffer.ReadByte(), Is.EqualTo( 0xC2 ) );
}
}