//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotCountBytesAlreadyInBuffer() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotCountBytesAlreadyInBuffer() { // Given int sizeLimit = 100; ByteBuf buffer = Unpooled.buffer(); int padding = Long.BYTES; buffer.writeLong(0); BoundedNetworkWritableChannel channel = new BoundedNetworkWritableChannel(buffer, sizeLimit); // When for (int i = 0; i < sizeLimit - padding; i++) { channel.Put(( sbyte )0); } // then it should be ok // again, when for (int i = 0; i < padding; i++) { channel.Put(( sbyte )0); } // then again, it should work // finally, when we pass the limit try { channel.Put(( sbyte )0); fail("Should not allow more bytes than what the limit dictates"); } catch (MessageTooBigException) { // then } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRespectSizeLimit() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRespectSizeLimit() { // Given int sizeLimit = 100; BoundedNetworkWritableChannel channel = new BoundedNetworkWritableChannel(Unpooled.buffer(), sizeLimit); // when for (int i = 0; i < sizeLimit; i++) { channel.Put(( sbyte )1); } try { channel.Put(( sbyte )1); fail("Should not allow more bytes than what the limit dictates"); } catch (MessageTooBigException) { // then } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void sizeLimitShouldWorkWithArrays() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SizeLimitShouldWorkWithArrays() { // Given int sizeLimit = 100; BoundedNetworkWritableChannel channel = new BoundedNetworkWritableChannel(Unpooled.buffer(), sizeLimit); // When int padding = 10; for (int i = 0; i < sizeLimit - padding; i++) { channel.Put(( sbyte )0); } try { channel.Put(new sbyte[padding * 2], padding * 2); fail("Should not allow more bytes than what the limit dictates"); } catch (MessageTooBigException) { // then } }