Exemple #1
0
    public void ForNonSeekable(string input, params string[] lines)
    {
        using (var s = new AnonymousPipeServerStream())
            using (var c = new AnonymousPipeClientStream(s.GetClientHandleAsString()))
            {
                var bytes = Encoding.ASCII.GetBytes(input);
                s.Write(bytes, 0, bytes.Length);
                s.Close();

                var skipLF = false;
                foreach (var line in lines)
                {
                    Assert.Equal(line, c.ReadProtocolLineWithEnd(skipLF));
                    skipLF = (line.Last() == '\r');
                }
            }

        using (var s = new AnonymousPipeServerStream())
            using (var c = new AnonymousPipeClientStream(s.GetClientHandleAsString()))
            {
                var bytes = Encoding.ASCII.GetBytes(input);
                s.Write(bytes, 0, bytes.Length);
                s.Close();

                var skipLF = false;
                foreach (var line in lines)
                {
                    Assert.Equal(line.TrimEnd(LineEnds), c.ReadProtocolLine(skipLF));
                    skipLF = (line.Last() == '\r');
                }
            }
    }