本文整理汇总了C#中LogEntry.WithExtension方法的典型用法代码示例。如果您正苦于以下问题:C# LogEntry.WithExtension方法的具体用法?C# LogEntry.WithExtension怎么用?C# LogEntry.WithExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogEntry
的用法示例。
在下文中一共展示了LogEntry.WithExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WithExtension_adds_new_extension_instance
public void WithExtension_adds_new_extension_instance()
{
var logEntry = new LogEntry(new object());
logEntry.WithExtension<EventLogInfo>();
Assert.That(logEntry.HasExtension<EventLogInfo>());
}
示例2: WithExtension_returns_existing_extension_of_specified_type
public void WithExtension_returns_existing_extension_of_specified_type()
{
var logEntry = new LogEntry(new object());
logEntry.WithExtension<EventLogInfo>().EventId = 2;
Assert.That(logEntry.WithExtension<EventLogInfo>().EventId,
Is.EqualTo(2));
}
示例3: ActivityId_is_a_JSON_property_when_added_using_WithExtension_Tracing_is_called
public void ActivityId_is_a_JSON_property_when_added_using_WithExtension_Tracing_is_called()
{
var activityId = Any.Guid();
Trace.CorrelationManager.ActivityId = activityId;
var entry = new LogEntry("hello");
entry.WithExtension<Tracing>();
var json = JsonConvert.SerializeObject(entry);
Console.WriteLine(json);
json.Should().Contain("\"ActivityId\":\"" + activityId + "\"");
}