Skip to content

Instantly share code, notes, and snippets.

@nedgrady
Created August 6, 2022 17:13
Show Gist options
  • Save nedgrady/09763aeba6723d884afa088f08fbfb2a to your computer and use it in GitHub Desktop.
Save nedgrady/09763aeba6723d884afa088f08fbfb2a to your computer and use it in GitHub Desktop.
[Test]
public void ExcelExportCapturesCommentsWithFunnyCharacters()
{
var transaction = new Transaction
{
Comment = "\u0001"
};
var transcationExportBuilderUnderTest = new TransactionExportBuilder();
transcationExportBuilderUnderTest.AddTransaction(transaction);
var excelExport = transcationExportBuilderUnderTest.BuildExcelFile();
var actualComment =
excelExport
.GetWorkbook("Export")
.GetColumn("Comment")
.GetDataInCellAtRow(1);
// Unicode 0001 is not valid in the XML 1.0 grammar as per https://www.w3.org/TR/xml/#charsets
Assert.AreEqual(actualComment, "\u0001");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment