61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
// <copyright file="HybridLogicalClockTests.Constructor.cs" company="StellaOps">
|
|
// Copyright (c) StellaOps. Licensed under BUSL-1.1.
|
|
// </copyright>
|
|
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<ArgumentNullException>()
|
|
.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<ArgumentException>();
|
|
}
|
|
|
|
[Fact]
|
|
public void Constructor_NullStateStore_ThrowsArgumentNullException()
|
|
{
|
|
var act = () => new HybridLogicalClock(
|
|
CreateTimeProvider(),
|
|
TestNodeId,
|
|
null!,
|
|
_nullLogger);
|
|
|
|
act.Should().Throw<ArgumentNullException>()
|
|
.WithParameterName("stateStore");
|
|
}
|
|
|
|
[Fact]
|
|
public void Constructor_NullLogger_ThrowsArgumentNullException()
|
|
{
|
|
var act = () => new HybridLogicalClock(
|
|
CreateTimeProvider(),
|
|
TestNodeId,
|
|
new InMemoryHlcStateStore(),
|
|
null!);
|
|
|
|
act.Should().Throw<ArgumentNullException>()
|
|
.WithParameterName("logger");
|
|
}
|
|
}
|