stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// <copyright file="InMemoryHlcStateStoreTests.Load.cs" company="StellaOps">
|
||||
// Copyright (c) StellaOps. Licensed under BUSL-1.1.
|
||||
// </copyright>
|
||||
using FluentAssertions;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.HybridLogicalClock.Tests;
|
||||
|
||||
public sealed partial class InMemoryHlcStateStoreTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task LoadAsync_NoState_ReturnsNullAsync()
|
||||
{
|
||||
var store = new InMemoryHlcStateStore();
|
||||
|
||||
var result = await store.LoadAsync("node1", CancellationToken.None);
|
||||
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LoadAsync_NullNodeId_ThrowsArgumentNullExceptionAsync()
|
||||
{
|
||||
var store = new InMemoryHlcStateStore();
|
||||
|
||||
var act = () => store.LoadAsync(null!, CancellationToken.None);
|
||||
|
||||
await act.Should().ThrowAsync<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LoadAsync_WhitespaceNodeId_ThrowsArgumentExceptionAsync()
|
||||
{
|
||||
var store = new InMemoryHlcStateStore();
|
||||
|
||||
var act = () => store.LoadAsync(" ", CancellationToken.None);
|
||||
|
||||
await act.Should().ThrowAsync<ArgumentException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task LoadAsync_Cancelled_ThrowsOperationCanceledExceptionAsync()
|
||||
{
|
||||
var store = new InMemoryHlcStateStore();
|
||||
using var cts = new CancellationTokenSource();
|
||||
cts.Cancel();
|
||||
|
||||
var act = () => store.LoadAsync("node1", cts.Token);
|
||||
|
||||
await act.Should().ThrowAsync<OperationCanceledException>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user