public void PaCa() { AsynchronousConsumer(); stream = new OutputStream(next, complete); IAsyncResult latest = null; var iasr0 = BeginWriteString("asdf", iasr => latest = iasr); ct(); Assert.IsFalse(iasr0.CompletedSynchronously); Assert.AreSame(iasr0, latest); var iasr1 = BeginWriteString("jkl;", iasr => latest = iasr); ct(); Assert.IsFalse(iasr1.CompletedSynchronously); Assert.AreSame(iasr1, latest); var iasr2 = BeginWriteString("lol", iasr => latest = iasr); ct(); Assert.IsFalse(iasr2.CompletedSynchronously); Assert.AreSame(iasr2, latest); stream.Dispose(); Assert.IsTrue(completed); Assert.AreEqual("asdfjkl;lol", sb.ToString()); }
public void PaCs() { SynchronousConsumer(); stream = new OutputStream(next, complete); Assert.IsTrue(BeginWriteString("asdf", iasr => { stream.EndWrite(iasr); }).CompletedSynchronously); Assert.IsTrue(BeginWriteString("jkl;", iasr => { stream.EndWrite(iasr); }).CompletedSynchronously); Assert.IsTrue(BeginWriteString("lol", iasr => { stream.EndWrite(iasr); }).CompletedSynchronously); stream.Dispose(); Assert.IsTrue(completed); Assert.AreEqual("asdfjkl;lol", sb.ToString()); }
public void PsCa() { AsynchronousConsumer(); stream = new OutputStream(next, complete); WriteString("asdf"); WriteString("jkl;"); WriteString("lol"); stream.Dispose(); Assert.IsTrue(completed); Assert.AreEqual("asdfjkl;lol", sb.ToString()); }
public void SetUp() { sb = new StringBuilder(); complete = () => completed = true; next = null; completed = false; stream = null; }