public void LogManyMessages_Concurrently() { const int listSize = 1000; string[][] messageLists = new[] { With <string> .CreateArrayOf(listSize, (int index) => $"Nachricht #{index}"), With <string> .CreateArrayOf(listSize, (int index) => $"Nachricht #{index + listSize}"), With <string> .CreateArrayOf(listSize, (int index) => $"Nachricht #{index + 2*listSize}"), };
public void LogManyMessages_SingleThread() { string[] messages = With <string> .CreateArrayOf(100, (int index) => $"Nachricht #{index}"); const string filePath = "log.txt"; using (var log = new SimpleFileLogger(filePath)) { foreach (string message in messages) { log.Trace(message); } } string[] actualLines = File.ReadAllLines(filePath); Assert.Equal(messages.Count(), actualLines.Count()); AssertThatEverySubstringIsContainedInDistinctLine(messages, actualLines, (message, line) => line.EndsWith(message)); File.Delete(filePath); }