Skip to content

Commit

Permalink
Add unit tests for chained StringBuilder.AppendSmart() and StringBuil…
Browse files Browse the repository at this point in the history
…der.AppendLineSmart()

#451
  • Loading branch information
Klikini committed Dec 4, 2024
1 parent ef527f1 commit b2bd680
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/SmartFormat.Tests/Extensions/SmartExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ public void Test_AppendLine()
Assert.That(actual, Is.EqualTo("these are the args" + Environment.NewLine));
}

[Test]
public void Test_AppendLine_Chained()
{
var actual = new StringBuilder()
.AppendLineSmart("{0} {1} {2}", "these", "are", "the")
.Append("args")
.ToString();

Assert.That(actual, Is.EqualTo("these are the" + Environment.NewLine + "args"));
}

[Test]
public void Test_Append()
{
Expand All @@ -44,6 +55,18 @@ public void Test_Append()
Assert.That(actual, Is.EqualTo("these are the args"));
}

[Test]
public void Test_Append_Chained()
{
var actual = new StringBuilder()
.AppendSmart("{0} {1}", "these", "are")
.Append(' ')
.AppendSmart("{0} {1}", "the", "args")
.ToString();

Assert.That(actual, Is.EqualTo("these are the args"));
}

#endregion

#region : TextWriterTests :
Expand Down

0 comments on commit b2bd680

Please sign in to comment.