stabilizaiton work - projects rework for maintenanceability and ui livening

This commit is contained in:
master
2026-02-03 23:40:04 +02:00
parent 074ce117ba
commit 557feefdc3
3305 changed files with 186813 additions and 107843 deletions

View File

@@ -0,0 +1,47 @@
// Disable xUnit analyzer warning for async methods - cancellation token not relevant for these unit tests
#pragma warning disable xUnit1051
using Xunit;
namespace StellaOps.HybridLogicalClock.Tests;
public partial class HybridLogicalClockTests
{
[Fact]
public void Current_ReturnsCurrentState()
{
var timeProvider = new FakeTimeProvider();
var stateStore = new InMemoryHlcStateStore();
var clock = CreateClock(timeProvider, stateStore);
var ts = clock.Tick();
var current = clock.Current;
Assert.Equal(ts.PhysicalTime, current.PhysicalTime);
Assert.Equal(ts.LogicalCounter, current.LogicalCounter);
Assert.Equal(ts.NodeId, current.NodeId);
}
[Fact]
public void NodeId_ReturnsConfiguredNodeId()
{
var timeProvider = new FakeTimeProvider();
var stateStore = new InMemoryHlcStateStore();
var clock = CreateClock(timeProvider, stateStore);
Assert.Equal(TestNodeId, clock.NodeId);
}
[Fact]
public async Task Tick_PersistsStateAsync()
{
var timeProvider = new FakeTimeProvider();
var stateStore = new InMemoryHlcStateStore();
var clock = CreateClock(timeProvider, stateStore);
var ts = clock.Tick();
var persisted = await stateStore.LoadAsync(TestNodeId);
Assert.NotNull(persisted);
Assert.Equal(ts.PhysicalTime, persisted.Value.PhysicalTime);
}
}