base32 refactoring
.NET Test / .NET tests (push) Failing after 1m54s

This commit is contained in:
2026-07-10 21:53:37 +04:00
parent d11c74e5d6
commit 566c813e8d
18 changed files with 375 additions and 88 deletions
+6 -3
View File
@@ -127,15 +127,18 @@ public class NextId
public void DefaultInstance_NextId_ShouldUseDefaultEpoch()
{
// Arrange
var now = DateTime.UtcNow;
var defaultEpoch = SeqId.DefaultEpoch;
long expectedTimestamp = ((long)(now - defaultEpoch).TotalMilliseconds) & TimestampMask; // Mask handles overflow
var now = new DateTime(2026, 6, 3, 21, 11, 1, DateTimeKind.Utc);
SeqId.Default.UnsafeReplaceDefaultTimeFactory(() => now);
// Act
long id = SeqId.NextId();
// Assert
long expectedTimestamp = GetExpectedTimestamp(now);
long timestampPart = (id >> TimestampShift) & TimestampMask;
timestampPart.ShouldBeInRange(expectedTimestamp, expectedTimestamp + 1);
static long GetExpectedTimestamp(DateTime now) => ((long)(now - SeqId.DefaultEpoch).TotalMilliseconds) & TimestampMask; // Mask handles overflow
}
}