public void MinForTimestamp() { var timestamp = Timestamp.Now; var minGuidForTimestamp = TimeGuid.MinForTimestamp(timestamp); Assert.That(minGuidForTimestamp.GetTimestamp(), Is.EqualTo(timestamp)); Assert.That(minGuidForTimestamp.GetClockSequence(), Is.EqualTo(TimeGuidBitsLayout.MinClockSequence)); Assert.That(minGuidForTimestamp.GetNode(), Is.EqualTo(TimeGuidBitsLayout.MinNode)); }
public void Before() { var timestamp = Timestamp.Now; Assert.That(TimeGuid.MaxForTimestamp(timestamp).Before(), Is.LessThan(TimeGuid.MaxForTimestamp(timestamp))); Assert.That(TimeGuid.MinForTimestamp(timestamp).Before(), Is.EqualTo(TimeGuid.MaxForTimestamp(timestamp - TimeSpan.FromTicks(1)))); Assert.That(new TimeGuid(timestamp, 1, TimeGuidBitsLayout.MinNode).Before(), Is.EqualTo(new TimeGuid(timestamp, 0, TimeGuidBitsLayout.MaxNode))); Assert.That(new TimeGuid(timestamp, 1, TimeGuidBitsLayout.MaxNode).Before(), Is.EqualTo(new TimeGuid(timestamp, 1, TimeGuidBitsLayout.DecrementNode(TimeGuidBitsLayout.MaxNode)))); Assert.Throws <InvalidOperationException>(() => TimeGuid.MinForTimestamp(new Timestamp(DateTime.MinValue))); }
public void IsTimeGuid() { Assert.That(TimeGuid.IsTimeGuid(Guid.NewGuid()), Is.False); Assert.That(TimeGuid.IsTimeGuid(minGuid), Is.False); Assert.That(TimeGuid.IsTimeGuid(maxGuid), Is.False); Assert.That(TimeGuid.IsTimeGuid(TimeGuid.NowGuid().ToGuid()), Is.True); Assert.That(TimeGuid.IsTimeGuid(TimeGuid.MinValue.ToGuid()), Is.True); Assert.That(TimeGuid.IsTimeGuid(TimeGuid.MaxValue.ToGuid()), Is.True); Assert.That(TimeGuid.IsTimeGuid(TimeGuid.MinForTimestamp(TimeGuidBitsLayout.GregorianCalendarStart).ToGuid()), Is.True); Assert.That(TimeGuid.IsTimeGuid(TimeGuid.MaxForTimestamp(TimeGuidBitsLayout.GregorianCalendarEnd).ToGuid()), Is.True); }
public void MinForTimestamp_ForGregorianCalendarStart() { Assert.That(TimeGuid.MinForTimestamp(TimeGuidBitsLayout.GregorianCalendarStart), Is.EqualTo(TimeGuid.MinValue)); }