Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldAllowLevelToBeChanged()
        internal virtual void ShouldAllowLevelToBeChanged()
        {
            // Given
            StringWriter writer = new StringWriter();
            FormattedLog log    = NewFormattedLog(writer, Level.Info);

            // When
            log.Info("No, it's when there's nothing wrong with you, but you hurt anyway. You get it?");
            log.Level = Level.Warn;
            log.Info("I know now why you cry. But it's something I can never do.");
            log.Level = Level.Debug;
            log.Info("There's 215 bones in the human body. That's one.");

            // Then
            assertThat(writer.ToString(), equalTo(format("%s%n%s%n", "1984-10-26 04:23:24.343+0000 INFO [test] No, it's when there's nothing wrong with you, but " + "you hurt anyway. You get it?", "1984-10-26 04:23:24.343+0000 INFO [test] There's 215 bones in the human body. That's one.")));
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldLogWithAbbreviatedClassNameAsContext()
        internal virtual void ShouldLogWithAbbreviatedClassNameAsContext()
        {
            // Given
            StringWriter         writer      = new StringWriter();
            FormattedLogProvider logProvider = NewFormattedLogProvider(writer);
            FormattedLog         log         = logProvider.GetLog(typeof(StringWriter));

            // When
            log.Info("Terminator 2");

            // Then
            assertThat(writer.ToString(), endsWith(format("INFO [j.i.StringWriter] Terminator 2%n")));
        }