public void GetDateTime_MaxIsTruncated_Exclusive() { System.DateTime max = new System.DateTime(1000, 1, 1, 0, 0, 0, 1); System.DateTime target = new System.DateTime(max.Ticks - 1); TestRandom rand = new TestRandom(); rand.ByteArrayQueue.Enqueue(System.BitConverter.GetBytes(max.Ticks)); Assert.AreEqual(target, rand.GetDateTime(System.DateTime.MinValue, max)); }
public void GetDateTime_MinIsTruncated_Inclusive() { System.DateTime min = new System.DateTime(1000, 1, 1, 0, 0, 0, 1); System.DateTime target = new System.DateTime(min.Year, min.Month, min.Day, min.Hour, min.Minute, min.Second, min.Millisecond - 1); TestRandom rand = new TestRandom(); rand.ByteArrayQueue.Enqueue(System.BitConverter.GetBytes(target.Ticks)); Assert.AreEqual(min, rand.GetDateTime(min, System.DateTime.MaxValue)); }
public void GetDateTime(System.DateTime target) { TestRandom rand = new TestRandom(); rand.ByteArrayQueue.Enqueue(System.BitConverter.GetBytes(target.Ticks)); Assert.AreEqual(target, rand.GetDateTime(System.DateTime.MinValue, System.DateTime.MaxValue)); }