public void TestSkip_PartialScalarAndFeed_NullAndAsIs()
		{
			using ( var stream = new MemoryStream() )
			using ( var target = Unpacker.Create( stream, false ) )
			{
				stream.Feed( new byte[] { 0xD2, 0x1, 0x2, 0x3 } );
				Assert.That( target.Skip(), Is.Null );
				// Feed
				stream.Feed( 0x4 );
				Assert.That( target.Skip(), Is.EqualTo( stream.Length ) );
			}
		}
		public void TestSkip_PartialHeaderMapScalarAndFeed_NullAndAsIs()
		{
			using ( var stream = new MemoryStream() )
			using ( var target = Unpacker.Create( stream, false ) )
			{
				stream.Feed( new byte[] { 0xDE, 0x0 } );
				Assert.That( target.Skip(), Is.Null );
				// Feed
				var feeding = new byte[] { 0x2, 0xD0, 0x1, 0xD0, 0x1, 0xD0, 0x2, 0xD0, 0x2 };
				stream.Feed( feeding );
				Assert.That( target.Skip(), Is.EqualTo( stream.Length ) );
			}
		}
		public void TestSkip_MapScalar_AsIs()
		{
			using ( var stream = new MemoryStream() )
			using ( var target = Unpacker.Create( stream, false ) )
			{
				stream.Feed( new byte[] { 0xDE, 0x0, 0x2, 0xD0, 0x1, 0xD0, 0x1, 0xD0, 0x2, 0xD0 } );
				Assert.That( target.Skip(), Is.Null );
				// Feed
				stream.Feed( 0x2 );
				Assert.That( target.Skip(), Is.EqualTo( stream.Length ) );
			}
		}
		public void TestSkip_PartialRawAndFeed_NullAndAsIs()
		{
			using ( var stream = new MemoryStream() )
			using ( var target = Unpacker.Create( stream, false ) )
			{
				stream.Feed( new byte[] { 0xA4, ( byte )'A', ( byte )'B', ( byte )'C' } );
				Assert.That( target.Skip(), Is.Null );
				// Feed
				stream.Feed( ( byte )'D' );
				Assert.That( target.Skip(), Is.EqualTo( stream.Length ) );
			}
		}
		public void TestSkip_ArrayScalar_AsIs()
		{
			using ( var stream = new MemoryStream() )
			using ( var target = Unpacker.Create( stream, false ) )
			{
				stream.Feed( new byte[] { 0xDD, 0x0, 0x0, 0x0, 0x2, 0xD2, 0x1, 0x2, 0x3, 0x4, 0xD2, 0x1, 0x2, 0x3, 0x4 } );
				Assert.That( target.Skip(), Is.EqualTo( stream.Length ) );
			}
		}
Example #6
0
		public async Task TestSkipAsync_MapScalar_AsIs()
		{
			using ( var stream = new MemoryStream() )
			using ( var target = Unpacker.Create( stream, false ) )
			{
				stream.Feed( new byte[] { 0xDE, 0x0, 0x2, 0xD0, 0x1, 0xD0, 0x1, 0xD0, 0x2, 0xD0, 0x2 } );
				Assert.That( await target.SkipAsync(), Is.EqualTo( stream.Length ) );
			}
		}