コード例 #1
0
ファイル: OutputStreamTests.cs プロジェクト: loudej/gato
        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());
        }
コード例 #2
0
ファイル: OutputStreamTests.cs プロジェクト: loudej/gato
        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());
        }
コード例 #3
0
ファイル: OutputStreamTests.cs プロジェクト: loudej/gato
        public void PsCs()
        {
            SynchronousConsumer();
            stream = new OutputStream(next, complete);

            WriteString("asdf");
            WriteString("jkl;");
            WriteString("lol");
            stream.Dispose();

            Assert.IsTrue(completed);
            Assert.AreEqual("asdfjkl;lol", sb.ToString());
        }