public void Can_Spawn_DateTimeOffsets_Within_Short_Range() { var dateTimes = new List <DateTimeOffset>(); for (var i = 0; i < 1000; i++) { dateTimes.Add(DateTimes.GetDateTimeOffset(DateTimeOffset.Now, DateTimeOffset.Now.AddHours(2))); } //Should not have any dates below the current date Assert.IsFalse(dateTimes.Any(x => x.Ticks < DateTimeOffset.Now.Ticks)); //All dates should be greater than the current date Assert.IsTrue(dateTimes.All(x => x.Ticks >= DateTimeOffset.Now.Ticks)); //All dates should be less than today's date one year from now Assert.IsTrue(dateTimes.All(x => x.Ticks <= DateTimeOffset.Now.AddYears(1).Ticks)); //All dates should not be the same Assert.IsFalse(dateTimes.All(x => x == dateTimes[0])); }
public override DateTimeOffset Generate() { return(DateTimes.GetDateTimeOffset(Min(), Max())); }