Exemplo n.º 1
0
        public void WriteLineReadOnlySpanChar_WritesToStream(int byteLength, string newLine)
        {
            // Arrange
            var stream = new TestMemoryStream();
            var writer = new HttpResponseStreamWriter(stream, Encoding.UTF8);

            writer.NewLine = newLine;
            // Act
            using (writer)
            {
                var array = new string('a', byteLength).ToCharArray();
                var span  = new ReadOnlySpan <char>(array);
                writer.WriteLine(span);
            }

            // Assert
            Assert.Equal(byteLength + newLine.Length, stream.Length);
        }