public void Should_log_with_null_exception()
            {
                var model = new SampleLogConsumer(_logger);

                model.NoArgAction();
                Assert.IsNull(_logger.Exception);
            }
            public void Should_log_type_and_method_name()
            {
                var model = new SampleLogConsumer(_logger);

                model.NoArgAction();
                Assert.AreEqual("SampleLogConsumer.NoArgAction()", _logger.Message);
            }
            public void Should_log_as_debug()
            {
                var model = new SampleLogConsumer(_logger);

                model.NoArgAction();
                Assert.AreEqual(LogLevel.Debug, _logger.Level);
            }
            public void Should_throw_if_logger_is_null()
            {
                var arg1 = "A";
                var arg2 = new DateTime(2001, 12, 31, 13, 45, 27);

                var model = new SampleLogConsumer(null);
                var ex    = Assert.Throws <ArgumentNullException>(() => model.Action(arg1, arg2));

                Assert.AreEqual("logger", ex.ParamName);
            }
            public void Should_log_arguments()
            {
                var arg1     = "A";
                var arg2     = new DateTime(2001, 12, 31, 13, 45, 27);
                var expected = string.Format("SampleLogConsumer.Action({0}, {1})", arg1, arg2);

                var model = new SampleLogConsumer(_logger);

                model.Action(arg1, arg2);
                Assert.AreEqual(expected, _logger.Message);
            }
            public void Should_log_placeholder_when_args_not_provided()
            {
                var arg1     = "A";
                var arg2     = new DateTime(2001, 12, 31, 13, 45, 27);
                var expected = string.Format("SampleLogConsumer.ActionNoArgsLogged(...)");

                var model = new SampleLogConsumer(_logger);

                model.ActionNoArgsLogged(arg1, arg2);

                Assert.AreEqual(expected, _logger.Message);
            }
            public void Should_throw_if_logger_is_null()
            {
                var arg1 = "A";
                var arg2 = new DateTime(2001, 12, 31, 13, 45, 27);

                var model = new SampleLogConsumer(null);
                var ex = Assert.Throws<ArgumentNullException>(()=> model.Action(arg1, arg2));
                Assert.AreEqual("logger", ex.ParamName);
            }
            public void Should_log_placeholder_when_args_not_provided()
            {
                var arg1 = "A";
                var arg2 = new DateTime(2001, 12, 31, 13, 45, 27);
                var expected = string.Format("SampleLogConsumer.ActionNoArgsLogged(...)");

                var model = new SampleLogConsumer(_logger);
                model.ActionNoArgsLogged(arg1, arg2);

                Assert.AreEqual(expected, _logger.Message);
            }
            public void Should_log_arguments()
            {
                var arg1 = "A";
                var arg2 = new DateTime(2001, 12, 31, 13, 45, 27);
                var expected = string.Format("SampleLogConsumer.Action({0}, {1})", arg1, arg2);

                var model = new SampleLogConsumer(_logger);
                model.Action(arg1, arg2);
                Assert.AreEqual(expected, _logger.Message);
            }
 public void Should_log_type_and_method_name()
 {
     var model = new SampleLogConsumer(_logger);
     model.NoArgAction();
     Assert.AreEqual("SampleLogConsumer.NoArgAction()", _logger.Message);
 }
 public void Should_log_with_null_exception()
 {
     var model = new SampleLogConsumer(_logger);
     model.NoArgAction();
     Assert.IsNull(_logger.Exception);
 }
 public void Should_log_as_debug()
 {
     var model = new SampleLogConsumer(_logger);
     model.NoArgAction();
     Assert.AreEqual(LogLevel.Debug, _logger.Level);
 }