public void Instantiates_With_Null_Exception_Given_Null(DiagnosticLevel level, string message)
        {
            var e = new DiagnosticGeneratedEventArgs(level, message);

            Assert.Equal(level, e.Level);
            Assert.Equal(message, e.Message);
            Assert.Null(e.Exception);
        }
        public void Instantiates_With_The_Given_Data(DiagnosticLevel level, string message, Exception exception)
        {
            var e = new DiagnosticGeneratedEventArgs(level, message, exception);

            Assert.Equal(level, e.Level);
            Assert.Equal(message, e.Message);
            Assert.Equal(exception, e.Exception);
        }
        public void Does_Not_Raise_Event_On_Info_When_Level_Is_Gt_Info(string message)
        {
            DiagnosticGeneratedEventArgs e = null;

            var d = new DiagnosticFactory(this, DiagnosticLevel.Warning, (args) =>
            {
                e = args;
            });

            d.Info(message);

            Assert.Null(e);
        }
        public void Raises_Event_On_Info(string message)
        {
            DiagnosticGeneratedEventArgs e = null;

            var d = new DiagnosticFactory(this, DiagnosticLevel.Info, (args) =>
            {
                e = args;
            });

            d.Info(message);

            Assert.Equal(message, e.Message);
            Assert.Equal(DiagnosticLevel.Info, e.Level);
            Assert.False(e.IncludesException);
            Assert.Null(e.Exception);
        }
        public void IncludesException_Returns_False_Given_Null_Exception(DiagnosticLevel level, string message)
        {
            var e = new DiagnosticGeneratedEventArgs(level, message);

            Assert.False(e.IncludesException);
        }
예제 #6
0
 private static void Client_DiagnosticMessageGenerated(object sender, DiagnosticGeneratedEventArgs e)
 {
     Console.WriteLine($"[DIAGNOSTICS] [{e.Level}]: {e.Message}");
 }