Exemplo n.º 1
0
 public void StartWork()
 {
     while (!stopFlag)
     {
         System.Threading.Thread.Sleep(rnd.Next(sleepTimeFrom, sleepTimeTo));
         var generatedString = RandomTextGenerator.GetRandomString(rnd.Next());
         OnDataGeneration(new GeneratedData {
             ThreadID = Thread.CurrentThread.Name, Data = generatedString, Time = DateTime.Now
         });
     }
 }
Exemplo n.º 2
0
        public void Test_RandomGenerator()
        {
            string result1 = RandomTextGenerator.GetRandomString(1);
            string result2 = RandomTextGenerator.GetRandomString(2);
            string result3 = RandomTextGenerator.GetRandomString(3);

            Assert.IsTrue(result1.Length >= 5 && result1.Length <= 10);
            Assert.IsTrue(result2.Length >= 5 && result2.Length <= 10);
            Assert.IsTrue(result3.Length >= 5 && result3.Length <= 10);

            Assert.AreNotEqual(result1, result2);
            Assert.AreNotEqual(result2, result3);
            Assert.AreNotEqual(result1, result3);
        }