Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void testCanPackAndUnpackMapStream() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void TestCanPackAndUnpackMapStream()
        {
            // Given
            Machine machine = new Machine();

            // When
            PackStream.Packer packer = machine.Packer();
            packer.PackMapStreamHeader();
            packer.Pack("one");
            packer.pack(1);
            packer.Pack("two");
            packer.pack(2);
            packer.PackEndOfStream();
            packer.Flush();
            PackStream.Unpacker unpacker = NewUnpacker(machine.Output());

            // Then

            assertThat(unpacker.UnpackMapHeader(), equalTo(PackStream.UNKNOWN_SIZE));

            assertThat(unpacker.UnpackString(), equalTo("one"));
            assertThat(unpacker.UnpackLong(), equalTo(1L));
            assertThat(unpacker.UnpackString(), equalTo("two"));
            assertThat(unpacker.UnpackLong(), equalTo(2L));

            unpacker.UnpackEndOfStream();
        }