public override void Write(Char value) { if (_matchIndex == Environment.NewLine.Length) { WriteIndentation(); _matchIndex = 0; } _matchIndex = Environment.NewLine[_matchIndex] == value ? _matchIndex + 1 : 0; base.Write(value); }
public void Write_WithNoIndentation() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, " "); iw.Write("Hello\r\nWorld"); String result = sw.GetStringBuilder().ToString(); Assert.AreEqual("Hello\r\nWorld", result); }