当前位置: 首页>>代码示例>>C#>>正文


C# LogWriter.Log方法代码示例

本文整理汇总了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[]>());
        }
开发者ID:DangerousDarlow,项目名称:Logging,代码行数:13,代码来源:LogWriterTest.cs

示例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[]>());
        }
开发者ID:DangerousDarlow,项目名称:Logging,代码行数:16,代码来源:LogWriterTest.cs

示例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);
        }
开发者ID:DangerousDarlow,项目名称:Logging,代码行数:15,代码来源:LogWriterTest.cs


注:本文中的LogWriter.Log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。