Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11597 for trunk


Ignore:
Timestamp:
11/27/14 16:00:00 (10 years ago)
Author:
ascheibe
Message:

#2112 added a unit test for the cap method of the ThreadSafeLog

File:
1 edited

Legend:

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

    r11171 r11597  
    2828  [TestClass]
    2929  public class ThreadSafeLogTest {
    30 
    3130    [TestMethod]
    3231    [TestCategory("General")]
     
    4342      Assert.AreEqual(count, log.Messages.Count());
    4443    }
     44
     45    [TestMethod]
     46    [TestCategory("General")]
     47    [TestProperty("Time", "short")]
     48    public void ThreadSafeLogThreadCapTest() {
     49      int count = 10000;
     50      int cap = 500;
     51      ThreadSafeLog log = new ThreadSafeLog(cap);
     52
     53      Parallel.For(0, count, (i) => {
     54        log.LogMessage("Message " + i); // write something
     55        log.Messages.Count(); // iterate over all messages
     56      });
     57
     58      Assert.AreEqual(cap, log.Messages.Count());
     59    }
    4560  }
    4661}
Note: See TracChangeset for help on using the changeset viewer.