Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReturnSameLoggerForSameContext()
        internal virtual void ShouldReturnSameLoggerForSameContext()
        {
            // Given
            DuplicatingLogProvider logProvider = new DuplicatingLogProvider();

            // Then
            DuplicatingLog log = logProvider.GetLog("test context");

            assertThat(logProvider.GetLog("test context"), sameInstance(log));
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReturnSameLoggerForSameClass()
        internal virtual void ShouldReturnSameLoggerForSameClass()
        {
            // Given
            DuplicatingLogProvider logProvider = new DuplicatingLogProvider();

            // Then
            DuplicatingLog log = logProvider.getLog(this.GetType());

            assertThat(logProvider.GetLog(typeof(DuplicatingLogProviderTest)), sameInstance(log));
        }
Exemple #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBulkOutputToMultipleLogs()
        internal virtual void ShouldBulkOutputToMultipleLogs()
        {
            // Given
            AssertableLogProvider logProvider = new AssertableLogProvider();
            Log log1 = logProvider.GetLog("log 1");
            Log log2 = logProvider.GetLog("log 2");

            DuplicatingLog log = new DuplicatingLog(log1, log2);

            // When
            log.Bulk(bulkLog => bulkLog.info("When the going gets weird"));

            // Then
            logProvider.AssertExactly(AssertableLogProvider.InLog("log 1").info("When the going gets weird"), AssertableLogProvider.InLog("log 2").info("When the going gets weird"));
        }
Exemple #4
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private static void bulk(final java.util.LinkedList<Log> remaining, final java.util.ArrayList<Log> bulkLogs, final System.Action<Log> finalConsumer)
        private static void Bulk(LinkedList <Log> remaining, List <Log> bulkLogs, System.Action <Log> finalConsumer)
        {
            if (remaining.Count > 0)
            {
                Log log = remaining.pop();
                log.Bulk(bulkLog =>
                {
                    bulkLogs.Add(bulkLog);
                    Bulk(remaining, bulkLogs, finalConsumer);
                });
            }
            else
            {
                Log log = new DuplicatingLog(bulkLogs);
                finalConsumer(log);
            }
        }
Exemple #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldRemoveLogFromDuplication()
        internal virtual void ShouldRemoveLogFromDuplication()
        {
            // Given
            AssertableLogProvider logProvider = new AssertableLogProvider();
            Log log1 = logProvider.GetLog("log 1");
            Log log2 = logProvider.GetLog("log 2");

            DuplicatingLog log = new DuplicatingLog(log1, log2);

            // When
            log.Info("When the going gets weird");
            log.Remove(log1);
            log.Info("The weird turn pro");

            // Then
            logProvider.AssertExactly(AssertableLogProvider.InLog("log 1").info("When the going gets weird"), AssertableLogProvider.InLog("log 2").info("When the going gets weird"), AssertableLogProvider.InLog("log 2").info("The weird turn pro"));
        }