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:
43
tests/ZB.MOM.WW.CBDDC.Core.Tests/DatasetAwareModelTests.cs
Normal file
43
tests/ZB.MOM.WW.CBDDC.Core.Tests/DatasetAwareModelTests.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.Text.Json;
|
||||
using ZB.MOM.WW.CBDDC.Core.Storage;
|
||||
|
||||
namespace ZB.MOM.WW.CBDDC.Core.Tests;
|
||||
|
||||
public class DatasetAwareModelTests
|
||||
{
|
||||
[Fact]
|
||||
public void DocumentMetadata_ShouldDefaultDatasetId_ToPrimary()
|
||||
{
|
||||
var metadata = new DocumentMetadata("Users", "42", new HlcTimestamp(100, 0, "node"));
|
||||
|
||||
metadata.DatasetId.ShouldBe(DatasetId.Primary);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DocumentMetadata_SerializationRoundTrip_ShouldPreserveDatasetId()
|
||||
{
|
||||
var original = new DocumentMetadata("Users", "42", new HlcTimestamp(100, 0, "node"), false, "logs");
|
||||
|
||||
string json = JsonSerializer.Serialize(original);
|
||||
var restored = JsonSerializer.Deserialize<DocumentMetadata>(json);
|
||||
|
||||
restored.ShouldNotBeNull();
|
||||
restored.DatasetId.ShouldBe("logs");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SnapshotMetadata_ShouldDefaultDatasetId_ToPrimary()
|
||||
{
|
||||
var metadata = new SnapshotMetadata();
|
||||
|
||||
metadata.DatasetId.ShouldBe(DatasetId.Primary);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PeerOplogConfirmation_ShouldDefaultDatasetId_ToPrimary()
|
||||
{
|
||||
var confirmation = new PeerOplogConfirmation();
|
||||
|
||||
confirmation.DatasetId.ShouldBe(DatasetId.Primary);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user