本文整理汇总了C#中LogWriter.Log方法的典型用法代码示例。如果您正苦于以下问题:C# LogWriter.Log方法的具体用法?C# LogWriter.Log怎么用?C# LogWriter.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogWriter
的用法示例。
在下文中一共展示了LogWriter.Log方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write_does_not_occur_if_encoder_returns_null_bytes
public void Write_does_not_occur_if_encoder_returns_null_bytes()
{
var encoder = Substitute.For<ILogEncoder>();
encoder.EncodeLogMessage(Arg.Any<string>(), Arg.Any<object[]>()).Returns(x => null);
var byteWriter = Substitute.For<IByteWriter>();
var logWriter = new LogWriter(encoder, byteWriter);
logWriter.Log("id");
encoder.Received(1).EncodeLogMessage(Arg.Any<string>(), Arg.Any<object[]>());
byteWriter.Received(1).WriteBytes(Arg.Any<byte[]>());
}
示例2: Log_encodes_using_encoder_then_writes_using_all_byte_writers
public void Log_encodes_using_encoder_then_writes_using_all_byte_writers()
{
var encoder = Substitute.For<ILogEncoder>();
var byteWriter1 = Substitute.For<IByteWriter>();
var byteWriter2 = Substitute.For<IByteWriter>();
var logWriter = new LogWriter(encoder, byteWriter1, byteWriter2);
const string id = "id";
logWriter.Log(id);
encoder.Received(1).EncodeLogMessage(id, Arg.Any<object[]>());
byteWriter1.Received(2).WriteBytes(Arg.Any<byte[]>());
byteWriter2.Received(2).WriteBytes(Arg.Any<byte[]>());
}
示例3: Log_passes_parameters_to_encoder
public void Log_passes_parameters_to_encoder()
{
var encoder = Substitute.For<ILogEncoder>();
var byteWriter1 = Substitute.For<IByteWriter>();
var byteWriter2 = Substitute.For<IByteWriter>();
var logWriter = new LogWriter(encoder, byteWriter1, byteWriter2);
const string id = "id";
var parameters = new object[0];
logWriter.Log(id, parameters);
encoder.Received(1).EncodeLogMessage(id, parameters);
}