public void transport_connected_after_on_response() { del = new HttpResponseDelegate(false, false, false, connectionClosedAction); del.renderer = new MockHeaderRender(); del.OnResponse(Head(), null); Assert.That(connectionClosed, Is.False); var abort = del.Connect(mockConsumer); Assert.That(mockConsumer.Buffer.ToString(), Is.EqualTo("[headers]")); Assert.That(mockConsumer.GotEnd, Is.True); Assert.That(connectionClosed, Is.True); }
public void transport_connected_after_on_response([Values(true, false)] bool expectContinue) { del = new HttpResponseDelegate(false, false, connectionClosedAction); del.renderer = new MockHeaderRender(); if (expectContinue) del.WriteContinue(); del.OnResponse(Head(), null); Assert.That(connectionClosed, Is.False); var abort = del.Connect(mockConsumer); AssertConsumer(expectContinue: expectContinue, expectBody: false); }
public void transport_connected_after_on_response__async_producer__begin_producing_after_on_connect() { del = new HttpResponseDelegate(false, false, false, connectionClosedAction); del.renderer = new MockHeaderRender(); Action startProducing = null; del.OnResponse(Head(), MockDataProducer.Create(new string[] { "Chunk1", "Chunk2", "Chunk3" }, false, () => { }, s => startProducing = s)); Assert.That(connectionClosed, Is.False); var abort = del.Connect(mockConsumer); startProducing(); mockConsumer.Continuation(); mockConsumer.Continuation(); mockConsumer.Continuation(); AssertConsumer(); }
public void transport_connected_before_on_response__sync_producer__begin_producing_on_connect() { del = new HttpResponseDelegate(false, false, false, connectionClosedAction); del.renderer = new MockHeaderRender(); var abort = del.Connect(mockConsumer); del.OnResponse(Head(), MockDataProducer.Create(new string[] { "Chunk1", "Chunk2", "Chunk3" }, true, () => { }, s => s())); AssertConsumer(); }
public void transport_connected_after_on_response__async_producer__begin_producing_on_connect([Values(true, false)] bool expectContinue) { del = new HttpResponseDelegate(false, false, connectionClosedAction); del.renderer = new MockHeaderRender(); if (expectContinue) del.WriteContinue(); del.OnResponse(Head(), MockDataProducer.Create(new string[] { "Chunk1", "Chunk2", "Chunk3" }, false, () => { }, s => s())); Assert.That(connectionClosed, Is.False); var abort = del.Connect(mockConsumer); mockConsumer.Continuation(); mockConsumer.Continuation(); mockConsumer.Continuation(); AssertConsumer(expectContinue, true); }