Fix #2 - RequestsAhead not recalculating correctly #3

Merged
henry merged 2 commits from requests-ahead-bug into main 2025-05-12 22:22:42 +00:00
1 changed files with 13 additions and 0 deletions
Showing only changes of commit 449b821633 - Show all commits

View File

@ -245,6 +245,19 @@ namespace AccessQueueServiceTests
Assert.Equal(0, response.RequestsAhead);
}
[Fact]
public async Task RequestAccess_ShouldShowCorrectRequestsAhead_WhenAccessRerequested()
{
for (int i = 0; i < CAP_LIMIT + 3; i++)
{
await _accessService.RequestAccess(Guid.NewGuid());
}
var id = Guid.NewGuid();
var response = await _accessService.RequestAccess(id);
Assert.Equal(3, response.RequestsAhead);
response = await _accessService.RequestAccess(id);
Assert.Equal(3, response?.RequestsAhead);
}
}
}
}