Added customized AppendLine() for StringBuilder
This commit is contained in:
@@ -7,6 +7,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
namespace AMWD.Common.Tests.Extensions
|
||||
{
|
||||
[TestClass]
|
||||
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
|
||||
public class StreamExtensionsTests
|
||||
{
|
||||
[TestMethod]
|
||||
|
||||
@@ -333,5 +333,21 @@ namespace AMWD.Common.Tests.Extensions
|
||||
Assert.IsNull(hexDecodeNull);
|
||||
Assert.AreEqual("", hexDecodeEmpty);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ShouldAddCustomLineTermination()
|
||||
{
|
||||
// arrange
|
||||
string value = "abc";
|
||||
var sb = new StringBuilder();
|
||||
|
||||
// act
|
||||
sb.AppendLine(value, "\r");
|
||||
sb.AppendLine(value, "\r");
|
||||
|
||||
// assert
|
||||
Assert.AreEqual($"{value}\r{value}\r", sb.ToString());
|
||||
Assert.IsFalse(sb.ToString().Contains('\n'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user