示例#1
0
 public override void Act()
 {
     base.Act();
     _durations   = LastLog.GetProperty <IEnumerable <int> >(Property.Durations.Name, Property.DefaultChildName);
     _details     = LastLog.GetProperty <string>(Property.Details);
     _detailLines = _details.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
 }
示例#2
0
        public void then_total_is_greater_or_equal_to_durations()
        {
            var durations = LastLog.GetProperty <IEnumerable <int> >(Property.Durations.Name, Property.DefaultChildName);
            var total     = LastLog.GetProperty <int>(Property.Durations.Name, Property.Durations.Total);

            total.Should().BeGreaterOrEqualTo(durations.Sum());
        }
 public void then_property_is_added_to_result()
 {
     LastLog.GetProperty <object>("parent")
     .Should().BeEquivalentTo(new Dictionary <string, object>
     {
         { "test property", "test value" }
     });
 }
示例#4
0
 public void then_exception_is_logged()
 {
     LastLog.GetProperty <ExceptionSummary>(Property.Exceptions).Should().BeEquivalentTo(
         new ExceptionSummary
     {
         Types  = new HashSet <string>(new[] { "Exception" }),
         Values = new[] { "System.Exception: Test" }
     });
 }
示例#5
0
 public void then_exception_attribute_is_filled_correctly()
 {
     LastLog.GetProperty <ExceptionSummary>(Property.Exceptions).Should().BeEquivalentTo(
         new ExceptionSummary
     {
         Types  = new HashSet <string>(new[] { "Exception" }),
         Values = new[]
         {
             "System.Exception: first",
             $"System.Exception: last ---> System.Exception: inner{Environment.NewLine}   --- End of inner exception stack trace ---"
         }
     });
 }
示例#6
0
 public void then_separate_log_message_level_is_info()
 {
     LastLog.GetProperty <string>(Property.LogLevel).Should().Be(LogLevel.Info.ToString());
 }
示例#7
0
 public void then_both_overrides_are_applied()
 {
     LastLog.GetProperty <object>(Property.Message).Should().BeEquivalentTo(new[] { "1", "2" });
 }
示例#8
0
 public void then_details_contain_first_exception_once()
 {
     AssertContains(LastLog.GetProperty <string>(Property.Details),
                    "System.Exception: first", 1);
 }
示例#9
0
 public void then_details_are_concatenated_from_2_messages()
 {
     LastLog.GetProperty <string>(Property.Details).Should().NotBeNullOrEmpty();
 }
示例#10
0
 public void then_durations_total_is_populated()
 {
     LastLog
     .GetProperty <int>(Property.Durations.Name, Property.Durations.Total)
     .Should().BeGreaterOrEqualTo(0);
 }
示例#11
0
 public void then_message_is_null()
 {
     LastLog.GetProperty <object>(Property.Message).Should().Be(null);
 }
示例#12
0
 public void then_log_level_is_set()
 {
     LastLog.GetProperty <string>(Property.LogLevel).Should().Be(LogLevel.Warn.ToString());
 }
示例#13
0
 public void then_operation_is_set()
 {
     LastLog.GetProperty <string>(Property.OperationName).Should().Be(OperationName);
 }
示例#14
0
 protected Dictionary <string, object> GetDurations()
 {
     return(LastLog.GetProperty <Dictionary <string, object> >(Property.Durations.Name));
 }
示例#15
0
 public void then_separate_log_message_is_created()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be(ThirdMessage);
 }
示例#16
0
 public void then_details_contain_last_exception_twice()
 {
     AssertContains(LastLog.GetProperty <string>(Property.Details),
                    "System.Exception: last", 2);
 }
示例#17
0
 public void then_override_is_applied(string propertyName, object newValue)
 {
     Act(propertyName, newValue);
     LastLog.GetProperty <object>(propertyName).Should().Be(newValue);
 }
示例#18
0
 public void then_details_contain_last_exception_full_once()
 {
     AssertContains(LastLog.GetProperty <string>(Property.Details),
                    _lastException.ToString(), 1);
 }
示例#19
0
 public void then_logging_happenned_after_completion()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be(TestMessage);
 }
示例#20
0
 public void then_separate_log_message_has_no_correlation_id()
 {
     LastLog.GetProperty <string>(Property.CorrelationId).Should().BeNull();
 }
示例#21
0
 public void then_correlation_id_is_set()
 {
     LastLog.GetProperty <string>(Property.CorrelationId).Should().Be(CorrelationId);
 }
示例#22
0
 public void then_empty_string_is_logged()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be(string.Empty);
 }
示例#23
0
 public void then_log_level_code_is_set()
 {
     LastLog.GetProperty <int>(Property.LogLevelCode).Should().Be((int)LogLevel.Warn);
 }
示例#24
0
 public void then_call_context_is_logged()
 {
     LastLog.GetProperty <object>(Property.Timestamp).Should().NotBeNull();
 }
示例#25
0
 public void then_higher_log_severity_is_picked_out_of_merge()
 {
     LastLog.GetProperty <string>(Property.LogLevel)
     .Should().Be("Error",
                  "Merge should have replaced accumulated value of the second log call with higher severity");
 }
示例#26
0
        public void then_details_are_populated()
        {
            var details = LastLog.GetProperty <string>(Property.Details);

            details.Should().EndWith("| " + LogMessage);
        }
示例#27
0
 public void then_message_from_default_application_log_is_logged()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be(LogMessage);
 }
示例#28
0
 public override void Act()
 {
     Logger.Warn(TestMessage);
     Complete();
     _generatedCorrelationId = LastLog.GetProperty <string>(Property.CorrelationId);
 }
示例#29
0
 public void then_durations_are_populated()
 {
     LastLog.GetProperty <IEnumerable <int> >(Property.Durations.Name, Property.DefaultChildName)
     .Count().Should().Be(3);
 }
示例#30
0
 public void then_message_is_formed_by_last_exception_type_and_message()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be("System.Exception: last");
 }