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

            // When
            PackStream.Packer packer = machine.Packer();
            packer.PackListStreamHeader();
            packer.Pack("eins");
            packer.Pack("zwei");
            packer.Pack("drei");
            packer.PackEndOfStream();
            packer.Flush();
            PackStream.Unpacker unpacker = NewUnpacker(machine.Output());

            // Then

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

            assertThat(unpacker.UnpackString(), equalTo("eins"));
            assertThat(unpacker.UnpackString(), equalTo("zwei"));
            assertThat(unpacker.UnpackString(), equalTo("drei"));

            unpacker.UnpackEndOfStream();
        }