public void testNewLogFileNextDay() { fileName = "test2"; AsyncLog test2 = new AsyncLog(fileName, filePath, threadSleep); DateTime today = new DateTime(); Random rnd = new Random(); int startFiles; int finishFiles; int logSize = 100; int randomNr = rnd.Next(26, 28); startFiles = Directory.GetFiles(filePath).Length; today = DateTime.Now; for (int i = 0; i < logSize; i++) { if (i == randomNr) { test2.setDate(today.AddDays(randomNr)); } test2.Write("Number with Flush: " + i.ToString()); Thread.Sleep(50); } finishFiles = Directory.GetFiles(filePath).Length; startFiles++; Assert.AreEqual(finishFiles, startFiles); }