Skip to content

Commit e3e5dc6

Browse files
committed
Failing test for issue #10
1 parent 164f20f commit e3e5dc6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Serilog.Sinks.AzureTableStorageWithProperties.Tests/AzureTableStorageWithPropertiesSinkTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,31 @@ public void WhenALoggerWritesToTheSinkItIsRetrievableFromTheTableWithProperties(
7474
Assert.Equal(" ", result.Properties["Space"].PropertyAsObject);
7575
}
7676

77+
[Fact]
78+
public void WhenALoggerWritesToTheSinkWithANewlineInTheTemplateItIsRetrievable()
79+
{
80+
// Prompted from https://github.com/serilog/serilog-sinks-azuretablestorage/issues/10
81+
var storageAccount = CloudStorageAccount.DevelopmentStorageAccount;
82+
var tableClient = storageAccount.CreateCloudTableClient();
83+
var table = tableClient.GetTableReference("LogEventEntity");
84+
85+
table.DeleteIfExists();
86+
87+
var logger = new LoggerConfiguration()
88+
.WriteTo.AzureTableStorageWithProperties(storageAccount)
89+
.CreateLogger();
90+
91+
var exception = new ArgumentException("Some exception");
92+
93+
const string messageTemplate = "Line 1\nLine2";
94+
95+
logger.Information(exception, messageTemplate);
96+
97+
var result = table.ExecuteQuery(new TableQuery().Take(1)).FirstOrDefault();
98+
99+
Assert.NotNull(result);
100+
}
101+
77102
[Fact]
78103
public void WhenALoggerWritesToTheSinkItStoresTheCorrectTypesForScalar()
79104
{

0 commit comments

Comments
 (0)