public void outboundbuffet_outof_test() { var outBoundBuffer = new OutBoundBuffer(2); var buf1 = new FixedLengthByteBuf(); var buf2 = new FixedLengthByteBuf(); var promise1 = new TaskCompletionSource(); var promise2 = new TaskCompletionSource(); outBoundBuffer.Add(new PendingMessage(buf1, promise1)); Assert.AreEqual(outBoundBuffer.Count, 1); Assert.AreEqual(outBoundBuffer.IsWritable, true); outBoundBuffer.Add(new PendingMessage(buf2, promise2)); Assert.AreEqual(outBoundBuffer.Count, 2); Assert.AreEqual(outBoundBuffer.IsWritable, false); try { outBoundBuffer.Add(new PendingMessage(buf2, promise2)); Assert.Fail(); } catch (OutOfBufferException) { Assert.IsTrue(true); } }
public void outboundbuffer_add_test() { var buf = new FixedLengthByteBuf(); var buffer = new OutBoundBuffer(); buffer.Enqueue(new PendingMessage(buf, new TaskCompletionSource())); Assert.AreEqual(buffer.Count, 1); var msg = buffer.Get(); Assert.AreEqual(buffer.Count, 0); }