예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeAndDeserializeNullUsingChannel() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSerializeAndDeserializeNullUsingChannel()
        {
            // given
            MemoryStream outputStream = new MemoryStream();
            OutputStreamWritableChannel writableChannel = new OutputStreamWritableChannel(outputStream);

            // when
            StringMarshal.Marshal(writableChannel, null);

            MemoryStream inputStream = new MemoryStream(outputStream.toByteArray());
            InputStreamReadableChannel readableChannel = new InputStreamReadableChannel(inputStream);
            string reconstructed = StringMarshal.Unmarshal(readableChannel);

            // then
            assertNull(reconstructed);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMarshalNullClusterId() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMarshalNullClusterId()
        {
            // given
            MemoryStream outputStream = new MemoryStream();

            // when
            OutputStreamWritableChannel writableChannel = new OutputStreamWritableChannel(outputStream);

            _marshal.marshal(null, writableChannel);

            InputStreamReadableChannel readableChannel = new InputStreamReadableChannel(new MemoryStream(outputStream.toByteArray()));
            ClusterId result = _marshal.unmarshal(readableChannel);

            // then
            assertNull(result);
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSerializeAndDeserializeEmptyStringUsingChannel() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSerializeAndDeserializeEmptyStringUsingChannel()
        {
            // given
            const string testString   = "";
            MemoryStream outputStream = new MemoryStream();
            OutputStreamWritableChannel writableChannel = new OutputStreamWritableChannel(outputStream);

            // when
            StringMarshal.Marshal(writableChannel, testString);

            MemoryStream inputStream = new MemoryStream(outputStream.toByteArray());
            InputStreamReadableChannel readableChannel = new InputStreamReadableChannel(inputStream);
            string reconstructed = StringMarshal.Unmarshal(readableChannel);

            // then
            assertNotSame(testString, reconstructed);
            assertEquals(testString, reconstructed);
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMarshalClusterId() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMarshalClusterId()
        {
            // given
            ClusterId    original     = new ClusterId(System.Guid.randomUUID());
            MemoryStream outputStream = new MemoryStream();

            // when
            OutputStreamWritableChannel writableChannel = new OutputStreamWritableChannel(outputStream);

            _marshal.marshal(original, writableChannel);

            InputStreamReadableChannel readableChannel = new InputStreamReadableChannel(new MemoryStream(outputStream.toByteArray()));
            ClusterId result = _marshal.unmarshal(readableChannel);

            // then
            assertNotSame(original, result);
            assertEquals(original, result);
        }