本文整理汇总了C#中Widget.ToLogString方法的典型用法代码示例。如果您正苦于以下问题:C# Widget.ToLogString方法的具体用法?C# Widget.ToLogString怎么用?C# Widget.ToLogString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget.ToLogString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Recursive_formatter_calls_do_not_cause_exceptions
public void Recursive_formatter_calls_do_not_cause_exceptions()
{
var widget = new Widget();
widget.Parts = new List<Part> { new Part { Widget = widget } };
Log.Formatters.RegisterPropertiesFormatter<Widget>();
Log.Formatters.RegisterPropertiesFormatter<Part>();
// this should not throw
var s = widget.ToLogString();
Console.WriteLine(s);
}
示例2: FormatterSet_does_not_expand_string
public void FormatterSet_does_not_expand_string()
{
var widget = new Widget();
widget.Parts = new List<Part> { new Part { Widget = widget } };
Log.Formatters.RegisterPropertiesFormatter<Widget>();
Log.Formatters.RegisterPropertiesFormatter<Part>();
// this should not throw
var s = widget.ToLogString();
Console.WriteLine(s);
Assert.IsFalse(s.Contains("Name = { D },{ e }"));
}
示例3: Formatter_does_not_expand_string
public void Formatter_does_not_expand_string()
{
// set up a recursive call, so that the custom formatter will not be used once we go far enough in
var widget = new Widget();
widget.Parts = new List<Part> { new Part { Widget = widget } };
Formatter<Widget>.RegisterForMembers();
Formatter<Part>.RegisterForMembers();
// this should not throw
var s = widget.ToLogString();
Assert.That(s, !Contains.Substring("Name = { D },{ e }"));
}