Exemple #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);
 }
        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" }
     });
 }
Exemple #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" }
     });
 }
 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 ---"
         }
     });
 }
Exemple #6
0
 public void then_separate_log_message_level_is_info()
 {
     LastLog.GetProperty <string>(Property.LogLevel).Should().Be(LogLevel.Info.ToString());
 }
Exemple #7
0
 public void then_both_overrides_are_applied()
 {
     LastLog.GetProperty <object>(Property.Message).Should().BeEquivalentTo(new[] { "1", "2" });
 }
 public void then_details_contain_first_exception_once()
 {
     AssertContains(LastLog.GetProperty <string>(Property.Details),
                    "System.Exception: first", 1);
 }
 public void then_details_are_concatenated_from_2_messages()
 {
     LastLog.GetProperty <string>(Property.Details).Should().NotBeNullOrEmpty();
 }
 public void then_durations_total_is_populated()
 {
     LastLog
     .GetProperty <int>(Property.Durations.Name, Property.Durations.Total)
     .Should().BeGreaterOrEqualTo(0);
 }
Exemple #11
0
 public void then_message_is_null()
 {
     LastLog.GetProperty <object>(Property.Message).Should().Be(null);
 }
Exemple #12
0
 public void then_log_level_is_set()
 {
     LastLog.GetProperty <string>(Property.LogLevel).Should().Be(LogLevel.Warn.ToString());
 }
Exemple #13
0
 public void then_operation_is_set()
 {
     LastLog.GetProperty <string>(Property.OperationName).Should().Be(OperationName);
 }
Exemple #14
0
 protected Dictionary <string, object> GetDurations()
 {
     return(LastLog.GetProperty <Dictionary <string, object> >(Property.Durations.Name));
 }
Exemple #15
0
 public void then_separate_log_message_is_created()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be(ThirdMessage);
 }
 public void then_details_contain_last_exception_twice()
 {
     AssertContains(LastLog.GetProperty <string>(Property.Details),
                    "System.Exception: last", 2);
 }
Exemple #17
0
 public void then_override_is_applied(string propertyName, object newValue)
 {
     Act(propertyName, newValue);
     LastLog.GetProperty <object>(propertyName).Should().Be(newValue);
 }
 public void then_details_contain_last_exception_full_once()
 {
     AssertContains(LastLog.GetProperty <string>(Property.Details),
                    _lastException.ToString(), 1);
 }
Exemple #19
0
 public void then_logging_happenned_after_completion()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be(TestMessage);
 }
Exemple #20
0
 public void then_separate_log_message_has_no_correlation_id()
 {
     LastLog.GetProperty <string>(Property.CorrelationId).Should().BeNull();
 }
Exemple #21
0
 public void then_correlation_id_is_set()
 {
     LastLog.GetProperty <string>(Property.CorrelationId).Should().Be(CorrelationId);
 }
 public void then_empty_string_is_logged()
 {
     LastLog.GetProperty <string>(Property.Message).Should().Be(string.Empty);
 }
Exemple #23
0
 public void then_log_level_code_is_set()
 {
     LastLog.GetProperty <int>(Property.LogLevelCode).Should().Be((int)LogLevel.Warn);
 }
Exemple #24
0
 public void then_call_context_is_logged()
 {
     LastLog.GetProperty <object>(Property.Timestamp).Should().NotBeNull();
 }
 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");
 }
Exemple #26
0
        public void then_details_are_populated()
        {
            var details = LastLog.GetProperty <string>(Property.Details);

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