# Class InMemoryLockProviderTest

Namespace
  adas_core.Test.Services

Assembly
  adas-core.Test.dll

    [TestFixture]
    public class InMemoryLockProviderTest

Inheritance
  object
  InMemoryLockProviderTest

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Methods

### AcquireAsync_IsThreadSafe_OnlyOneHolderAtATime_SingleSemaphorePerKey()

Verifies that `AcquireAsync` is thread-safe for a given key, ensuring that only one caller can hold the semaphore at a time even when multiple tasks compete concurrently for the same key, and that a single semaphore instance is created and reused per key.

    [Test]
    public Task AcquireAsync_IsThreadSafe_OnlyOneHolderAtATime_SingleSemaphorePerKey()

#### Returns

Task

### AcquireAsync_ReturnsFalse_WhenSemaphoreOccupiedAndTimeoutExpires()

Verifies that AcquireAsync returns false when the semaphore for the specified key is already occupied and the requested timeout expires before the lock can be acquired, and that the underlying semaphore is restored to a count of 1 after release.

    [Test]
    public Task AcquireAsync_ReturnsFalse_WhenSemaphoreOccupiedAndTimeoutExpires()

#### Returns

Task

### AcquireAsync_ReturnsTrue_AndCreatesEntryInLocksDictionary()

Verifies that AcquireAsync returns `true` and creates a corresponding entry in the locks dictionary when called with a valid key and time span.

    [Test]
    public Task AcquireAsync_ReturnsTrue_AndCreatesEntryInLocksDictionary()

#### Returns

Task

### ReleaseAsync_DoesNotThrow_WhenCalledWithoutPriorAcquire()

Verifies that `ReleaseAsync` does not throw when invoked without a prior `AcquireAsync` for the given key, and remains safe to call multiple times after a single successful acquire.

    [Test]
    public Task ReleaseAsync_DoesNotThrow_WhenCalledWithoutPriorAcquire()

#### Returns

Task

### ReleaseAsync_MakesSemaphoreAvailableForNextAcquire()

Verifies that calling `ReleaseAsync` on a semaphore provider restores availability, allowing a subsequent `AcquireAsync` for the same key to succeed and the semaphore's `CurrentCount` to transition back to its released value.

    [Test]
    public Task ReleaseAsync_MakesSemaphoreAvailableForNextAcquire()

#### Returns

Task

### SetUp()

Initializes a fresh InMemoryLockProvider instance for the test fixture, ensuring each test starts with a clean, isolated provider state.

    [SetUp]
    public void SetUp()