public void IncreasingIndentation_ByMustBeGreaterThanZero() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, " "); Assert.Throws <ArgumentOutOfRangeException>(() => iw.IncreaseIndentation(0)); Assert.Throws <ArgumentOutOfRangeException>(() => iw.IncreaseIndentation(-42)); }
public void IncreasingIndentation_NeverOverflows() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, " "); iw.IncreaseIndentation(Int32.MaxValue); iw.IncreaseIndentation(42); Assert.AreEqual(Int32.MaxValue, iw.Indentation); }
public void Write_WithIndentationTokenContainingNewLine_DoesNotRecurse() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, "\r\n "); iw.IncreaseIndentation(1); iw.Write("Hello\r\nWorld"); String result = sw.GetStringBuilder().ToString(); Assert.AreEqual("\r\n Hello\r\n\r\n World", result); }
public void Write_WithTwoLevelsOfIndentation() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, " "); iw.IncreaseIndentation(2); iw.Write("Hello\r\nWorld"); String result = sw.GetStringBuilder().ToString(); Assert.AreEqual(" Hello\r\n World", result); }
public void Write_WithIndentationTokenContainingNewLine_DoesNotRecurse() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, "\r\n "); iw.IncreaseIndentation(1); iw.Write("Hello\r\nWorld"); String result = sw.GetStringBuilder().ToString(); Assert.AreEqual("\r\n Hello\r\n\r\n World", result); }
public void Write_WithTwoLevelsOfIndentation() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, " "); iw.IncreaseIndentation(2); iw.Write("Hello\r\nWorld"); String result = sw.GetStringBuilder().ToString(); Assert.AreEqual(" Hello\r\n World", result); }
public void IncreasingIndentation_NeverOverflows() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, " "); iw.IncreaseIndentation(Int32.MaxValue); iw.IncreaseIndentation(42); Assert.AreEqual(Int32.MaxValue, iw.Indentation); }
public void IncreasingIndentation_ByMustBeGreaterThanZero() { var sw = new StringWriter(); var iw = new IndentingTextWriter(sw, " "); Assert.Throws<ArgumentOutOfRangeException>(() => iw.IncreaseIndentation(0)); Assert.Throws<ArgumentOutOfRangeException>(() => iw.IncreaseIndentation(-42)); }