//
// Copyright (c) StellaOps. Licensed under BUSL-1.1.
//
using FluentAssertions;
using Xunit;
namespace StellaOps.HybridLogicalClock.Tests;
public sealed partial class HybridLogicalClockTests
{
[Fact]
public void Constructor_NullTimeProvider_ThrowsArgumentNullException()
{
var act = () => new HybridLogicalClock(null!, TestNodeId, new InMemoryHlcStateStore(), _nullLogger);
act.Should().Throw()
.WithParameterName("timeProvider");
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void Constructor_InvalidNodeId_ThrowsArgumentException(string? nodeId)
{
var act = () => new HybridLogicalClock(
CreateTimeProvider(),
nodeId!,
new InMemoryHlcStateStore(),
_nullLogger);
act.Should().Throw();
}
[Fact]
public void Constructor_NullStateStore_ThrowsArgumentNullException()
{
var act = () => new HybridLogicalClock(
CreateTimeProvider(),
TestNodeId,
null!,
_nullLogger);
act.Should().Throw()
.WithParameterName("stateStore");
}
[Fact]
public void Constructor_NullLogger_ThrowsArgumentNullException()
{
var act = () => new HybridLogicalClock(
CreateTimeProvider(),
TestNodeId,
new InMemoryHlcStateStore(),
null!);
act.Should().Throw()
.WithParameterName("logger");
}
}