Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/03/11 18:34:23 (13 years ago)
Author:
ascheibe
Message:

#1631 inherited ThreadSafeLog from Log to fix the LockRecursionException problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab/3.3/Tests/ThreadSafeLogTest.cs

    r6551 r6862  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using System.Threading.Tasks;
     25using HeuristicLab.Common;
    2426using HeuristicLab.Core;
    2527using Microsoft.VisualStudio.TestTools.UnitTesting;
     
    4143      Assert.AreEqual(count, log.Messages.Count());
    4244    }
     45
     46    private ThreadSafeLog recursionInLogViewTestLog;
     47    [TestMethod]
     48    public void ThreadSafeLogRecursionInLogViewTest() {
     49      int count = 10;
     50      recursionInLogViewTestLog = new ThreadSafeLog();
     51      recursionInLogViewTestLog.MessageAdded += new EventHandler<EventArgs<string>>(log_MessageAdded);
     52
     53      for (int i = 0; i < count; i++) {
     54        recursionInLogViewTestLog.LogMessage("Message " + i);
     55      }
     56    }
     57    void log_MessageAdded(object sender, EventArgs<string> e) {
     58      //access Messages like LogView does
     59      Console.WriteLine(string.Join(Environment.NewLine, recursionInLogViewTestLog.Messages.ToArray()));
     60    }
    4361  }
    4462}
Note: See TracChangeset for help on using the changeset viewer.