本文整理匯總了C#中MsgPack.ItemsUnpacker.SkipAsync方法的典型用法代碼示例。如果您正苦於以下問題:C# ItemsUnpacker.SkipAsync方法的具體用法?C# ItemsUnpacker.SkipAsync怎麽用?C# ItemsUnpacker.SkipAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MsgPack.ItemsUnpacker
的用法示例。
在下文中一共展示了ItemsUnpacker.SkipAsync方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestSkipAsync_Ext8_Zero
public async Task TestSkipAsync_Ext8_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, PackerUnpackerStreamOptions.None ) )
{
var result = await target.SkipAsync();
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: TestSkipAsync_Ext32_Max
public async Task TestSkipAsync_Ext32_Max()
{
var binary = new byte[] { 0xC9 }.Concat( BitConverter.GetBytes( ( uint )0x10001 ).Reverse() ).Concat( new byte[] { 0x7F } ).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, PackerUnpackerStreamOptions.None ) )
{
var result = await target.SkipAsync();
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: TestSkipAsync_FixExt16
public async Task TestSkipAsync_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 = await target.SkipAsync();
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 ) );
}
}