diff --git a/Directory.Packages.props b/Directory.Packages.props
index 5622959..6ed18f3 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -5,14 +5,14 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/src/DistributedLockManager/DistributedLockManager.csproj b/src/DistributedLockManager/DistributedLockManager.csproj
index 4a563be..4969f80 100644
--- a/src/DistributedLockManager/DistributedLockManager.csproj
+++ b/src/DistributedLockManager/DistributedLockManager.csproj
@@ -1,6 +1,6 @@
- net9.0
+ net10.0
enable
enable
false
diff --git a/tests/DistributedLockManager.Tests/DistributedLockManager.Tests.csproj b/tests/DistributedLockManager.Tests/DistributedLockManager.Tests.csproj
index 8f11734..420c158 100644
--- a/tests/DistributedLockManager.Tests/DistributedLockManager.Tests.csproj
+++ b/tests/DistributedLockManager.Tests/DistributedLockManager.Tests.csproj
@@ -1,6 +1,6 @@
- net9.0
+ net10.0
false
enable
@@ -10,7 +10,7 @@
-
+
diff --git a/tests/DistributedLockManager.Tests/DistributedLockServiceIntegrationTests.cs b/tests/DistributedLockManager.Tests/DistributedLockServiceIntegrationTests.cs
index 61f0c76..94b5322 100644
--- a/tests/DistributedLockManager.Tests/DistributedLockServiceIntegrationTests.cs
+++ b/tests/DistributedLockManager.Tests/DistributedLockServiceIntegrationTests.cs
@@ -8,6 +8,7 @@
using DotNet.Testcontainers.Containers;
using NUnit.Framework;
using System.Linq;
+using Shouldly;
namespace DistributedLockManager.Tests;
@@ -68,9 +69,9 @@ public async Task RunWithLockAsync_acquires_and_executes_action()
var service = scope.ServiceProvider.GetRequiredService>();
var executed = false;
- executed = await service.RunWithLockAsync(async () => await SampleAsync(executed), "integration:test:key", CancellationToken.None, expiryInSecond: 5, waitInSecond: 2, retryInSecond: 1);
+ executed = await service.RunWithLockAsync(SampleAsync, "integration:test:key", CancellationToken.None, expiryInSecond: 5, waitInSecond: 2, retryInSecond: 1);
- Assert.IsTrue(executed, "Action should have been executed when lock acquired");
+ executed.ShouldBeTrue("Action should have been executed when lock acquired");
}
[Test, Order(2)]
@@ -108,13 +109,12 @@ async Task CriticalSection()
await Task.WhenAll(tasks);
// Only one should ever be in the critical section at a time
- Assert.LessOrEqual(maxConcurrent, 1, $"Expected no concurrent executions, but saw {maxConcurrent}");
- Assert.IsTrue(tasks.All(t => t.Result), "All tasks should complete successfully");
+ maxConcurrent.ShouldBeLessThanOrEqualTo(1, $"Expected no concurrent executions, but saw {maxConcurrent}");
+ tasks.All(t => t.Result).ShouldBeTrue("All tasks should complete successfully");
}
- private static async Task SampleAsync(bool executed)
+ private static async Task SampleAsync()
{
- executed = true;
- return await Task.FromResult(executed);
+ return await Task.FromResult(true);
}
}