Implement in-process multi-dataset sync isolation across core, network, persistence, and tests
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m14s
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m14s
This commit is contained in:
@@ -63,11 +63,35 @@ public class OplogEntryTests
|
||||
/// Verifies that an entry is valid when its stored hash matches computed content.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void IsValid_ShouldReturnTrue_WhenHashMatches()
|
||||
{
|
||||
var timestamp = new HlcTimestamp(100, 0, "node-1");
|
||||
var entry = new OplogEntry("col", "key", OperationType.Put, null, timestamp, "prev");
|
||||
|
||||
entry.IsValid().ShouldBeTrue();
|
||||
}
|
||||
}
|
||||
public void IsValid_ShouldReturnTrue_WhenHashMatches()
|
||||
{
|
||||
var timestamp = new HlcTimestamp(100, 0, "node-1");
|
||||
var entry = new OplogEntry("col", "key", OperationType.Put, null, timestamp, "prev");
|
||||
|
||||
entry.IsValid().ShouldBeTrue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that entries default to the primary dataset when dataset is omitted.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Constructor_ShouldDefaultDatasetId_ToPrimary()
|
||||
{
|
||||
var entry = new OplogEntry("col", "key", OperationType.Put, null, new HlcTimestamp(1, 0, "node"), "prev");
|
||||
|
||||
entry.DatasetId.ShouldBe(DatasetId.Primary);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that hash computation includes dataset identity to prevent cross-dataset collisions.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ComputeHash_ShouldDiffer_WhenDatasetDiffers()
|
||||
{
|
||||
var timestamp = new HlcTimestamp(100, 0, "node-1");
|
||||
var primary = new OplogEntry("col", "key", OperationType.Put, null, timestamp, "prev", datasetId: "primary");
|
||||
var logs = new OplogEntry("col", "key", OperationType.Put, null, timestamp, "prev", datasetId: "logs");
|
||||
|
||||
logs.Hash.ShouldNotBe(primary.Hash);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user