@@ -45,7 +45,7 @@ public void TestProcessMessage()
4545 public void TestProcessLevel ( )
4646 {
4747 var logRecord = new LogRecord ( ) ;
48- var logEvent = Some . SerilogEvent ( ) ;
48+ var logEvent = Some . DefaultSerilogEvent ( ) ;
4949
5050 LogRecordBuilder . ProcessLevel ( logRecord , logEvent ) ;
5151
@@ -57,7 +57,7 @@ public void TestProcessLevel()
5757 public void TestProcessProperties ( )
5858 {
5959 var logRecord = new LogRecord ( ) ;
60- var logEvent = Some . SerilogEvent ( ) ;
60+ var logEvent = Some . DefaultSerilogEvent ( ) ;
6161
6262 var prop = new LogEventProperty ( "property_name" , new ScalarValue ( "ok" ) ) ;
6363 var propertyKeyValue = PrimitiveConversions . NewStringAttribute ( "property_name" , "ok" ) ;
@@ -76,7 +76,7 @@ public void TestTimestamp()
7676 var nowNano = PrimitiveConversions . ToUnixNano ( now ) ;
7777
7878 var logRecord = new LogRecord ( ) ;
79- var logEvent = Some . SerilogEvent ( timestamp : now ) ;
79+ var logEvent = Some . SerilogEvent ( Some . TestMessageTemplate , timestamp : now ) ;
8080
8181 LogRecordBuilder . ProcessTimestamp ( logRecord , logEvent ) ;
8282
@@ -96,7 +96,7 @@ public void TestException()
9696 catch ( Exception ex )
9797 {
9898 var logRecord = new LogRecord ( ) ;
99- var logEvent = Some . SerilogEvent ( ex : ex ) ;
99+ var logEvent = Some . SerilogEvent ( Some . TestMessageTemplate , ex : ex ) ;
100100
101101 LogRecordBuilder . ProcessException ( logRecord , logEvent ) ;
102102
@@ -131,11 +131,14 @@ public void IncludeMessageTemplateMD5Hash()
131131 [ Fact ]
132132 public void IncludeMessageTemplateText ( )
133133 {
134- var logEvent = Some . SerilogEvent ( messageTemplate : Some . TestMessageTemplate ) ;
134+ var messageTemplate = "Hello, {Name}" ;
135+ var properties = new List < LogEventProperty > { new ( "Name" , new ScalarValue ( "World" ) ) } ;
136+
137+ var logEvent = Some . SerilogEvent ( messageTemplate , properties ) ;
135138
136139 var logRecord = LogRecordBuilder . ToLogRecord ( logEvent , null , IncludedData . MessageTemplateTextAttribute , new ( ) ) ;
137140
138- var expectedAttribute = new KeyValue { Key = SemanticConventions . AttributeMessageTemplateText , Value = new ( ) { StringValue = Some . TestMessageTemplate } } ;
141+ var expectedAttribute = new KeyValue { Key = SemanticConventions . AttributeMessageTemplateText , Value = new ( ) { StringValue = messageTemplate } } ;
139142 Assert . Contains ( expectedAttribute , logRecord . Attributes ) ;
140143 }
141144
@@ -146,7 +149,7 @@ public void IncludeTraceIdWhenActivityIsNull()
146149
147150 var collector = new ActivityContextCollector ( ) ;
148151
149- var logEvent = Some . SerilogEvent ( ) ;
152+ var logEvent = Some . DefaultSerilogEvent ( ) ;
150153 collector . CollectFor ( logEvent ) ;
151154
152155 var logRecord = LogRecordBuilder . ToLogRecord ( logEvent , null , IncludedData . TraceIdField | IncludedData . SpanIdField , collector ) ;
@@ -172,7 +175,7 @@ public void IncludeTraceIdAndSpanId()
172175
173176 var collector = new ActivityContextCollector ( ) ;
174177
175- var logEvent = Some . SerilogEvent ( ) ;
178+ var logEvent = Some . DefaultSerilogEvent ( ) ;
176179 collector . CollectFor ( logEvent ) ;
177180
178181 var logRecord = LogRecordBuilder . ToLogRecord ( logEvent , null , IncludedData . TraceIdField | IncludedData . SpanIdField , collector ) ;
@@ -182,10 +185,13 @@ public void IncludeTraceIdAndSpanId()
182185 }
183186
184187 [ Fact ]
185- public void IncludeTemplateBody ( )
188+ public void TemplateBodyIncludesMessageTemplateInBody ( )
186189 {
187- var logRecord = LogRecordBuilder . ToLogRecord ( Some . SerilogEvent ( ) , null , IncludedData . TemplateBody , new ( ) ) ;
190+ var messageTemplate = "Hello, {Name}" ;
191+ var properties = new List < LogEventProperty > { new ( "Name" , new ScalarValue ( "World" ) ) } ;
192+
193+ var logRecord = LogRecordBuilder . ToLogRecord ( Some . SerilogEvent ( messageTemplate , properties ) , null , IncludedData . TemplateBody , new ( ) ) ;
188194 Assert . NotNull ( logRecord . Body ) ;
189- Assert . Equal ( Some . TestMessageTemplate , logRecord . Body . StringValue ) ;
195+ Assert . Equal ( messageTemplate , logRecord . Body . StringValue ) ;
190196 }
191197}
0 commit comments