コード例 #1
0
        public static void Empty_line_should_not_contain_indent()
        {
            var withIndent = new StringWriter();

            using (var indentedWriter = new IndentedTextWriter(withIndent))
            {
                indentedWriter.Indent();
                indentedWriter.WriteLine("x");
                indentedWriter.WriteLine();
                indentedWriter.Write("x");
            }

            var withoutIndent = new StringWriter();

            using (var indentedWriter = new IndentedTextWriter(withoutIndent))
            {
                indentedWriter.Indent();
                indentedWriter.WriteLine("x");
                indentedWriter.Unindent();
                indentedWriter.WriteLine();
                indentedWriter.Indent();
                indentedWriter.Write("x");
            }

            Assert.That(withIndent.ToString(), Is.EqualTo(withoutIndent.ToString()));
        }