示例#1
0
 public void DateTimeGenerator_GenerateDateTime_50X_SUCCESS()
 {
     for (int i = 0; i < 50; i++)
     {
         DateTime generated = DateTimeGenerator.GenerateDateTime();
         Assert.NotEqual(new DateTime(), generated);
     }
 }
示例#2
0
        public void DateTimeGenerator_GenerateDateTime_ArgumentException_EqualDates()
        {
            var startDate = DateTime.Now;

            Exception ex = Assert.Throws <ArgumentException>(() =>
            {
                DateTime generated = DateTimeGenerator.GenerateDateTime(startDate, startDate);
            });

            Assert.StartsWith("Cannot generate a random date between do equal dates", ex.Message);
        }
示例#3
0
        public void DateTimeGenerator_GenerateDateTime_ArgumentException_MinMax()
        {
            var startDate = DateTime.Now;
            var endtDate  = startDate.AddYears(2);

            Exception ex = Assert.Throws <ArgumentException>(() =>
            {
                DateTime generated = DateTimeGenerator.GenerateDateTime(endtDate, startDate);
            });

            Assert.StartsWith("Minimum date should be lower than maximum date", ex.Message);
        }
示例#4
0
        public void DateTimeGenerator_GenerateDateTime_Ranged_50X_SUCCESS()
        {
            var startDate = DateTime.Now;
            var endtDate  = startDate.AddYears(2);

            for (int i = 0; i < 50; i++)
            {
                DateTime generated = DateTimeGenerator.GenerateDateTime(startDate, endtDate);
                Assert.NotEqual(new DateTime(), generated);
                Assert.InRange(generated, startDate, endtDate);
            }
        }