Initial commit: Add project files
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using KArtSell.Modules.ModelOperations.Domain;
|
||||
namespace KArtSell.ModelOperations.UnitTests;
|
||||
public sealed class ModelOperationLeaseTests
|
||||
{
|
||||
[Fact] public void Stale_token_cannot_renew() {
|
||||
var now=DateTimeOffset.UtcNow; var lease=new ModelOperationLease("J42","GLOBAL",new LeaseFencingToken(3),"worker-a",now.AddMinutes(5));
|
||||
Assert.Throws<InvalidOperationException>(()=>lease.Renew(new LeaseFencingToken(2),"worker-a",now.AddMinutes(10)));
|
||||
}
|
||||
[Fact] public void Expired_lease_transfer_increments_token() {
|
||||
var now=DateTimeOffset.UtcNow; var lease=new ModelOperationLease("J42","GLOBAL",new LeaseFencingToken(3),"worker-a",now.AddMinutes(-1));
|
||||
Assert.Equal(4,lease.Transfer(now,"worker-b",now.AddMinutes(5)).Value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user