Ejemplo n.º 1
0
        public void WriteOptions()
        {
            var options1 = new WriteOptions();
            var options2 = new WriteOptions();

            var fake   = new FakeWriter();
            var writer = new BufferedClientStreamWriter <string>(fake, 5);

            writer.WriteAsync("1");
            writer.WriteAsync("2", options1);
            writer.WriteAsync("3");
            writer.WriteAsync("4", options2);

            fake.CompleteCurrentTask();
            fake.CompleteCurrentTask();
            fake.CompleteCurrentTask();
            fake.CompleteCurrentTask();
            fake.AssertOptions(null, options1, options1, options2);

            // This should pick up options2 from the writer, not from the queue.
            writer.WriteAsync("5");
            fake.CompleteCurrentTask();
            fake.AssertOptions(null, options1, options1, options2, options2);
        }