2024-02-21 16:29:59 +01:00
|
|
|
|
using BenchmarkDotNet.Attributes;
|
|
|
|
|
using Bit.Core.Settings;
|
|
|
|
|
using Bit.Identity.IdentityServer;
|
|
|
|
|
using Duende.IdentityServer.Models;
|
|
|
|
|
|
|
|
|
|
namespace Bit.MicroBenchmarks.Identity.IdentityServer;
|
|
|
|
|
|
|
|
|
|
public class StaticClientStoreTests
|
|
|
|
|
{
|
|
|
|
|
private readonly StaticClientStore _store;
|
|
|
|
|
|
|
|
|
|
public StaticClientStoreTests()
|
|
|
|
|
{
|
|
|
|
|
_store = new StaticClientStore(new GlobalSettings());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Params("mobile", "connector", "invalid", "a_much_longer_invalid_value_that_i_am_making_up", "WEB", "")]
|
2024-08-15 23:14:22 +02:00
|
|
|
|
public string ClientId { get; set; } = null!;
|
2024-02-21 16:29:59 +01:00
|
|
|
|
|
|
|
|
|
[Benchmark]
|
|
|
|
|
public Client? TryGetValue()
|
|
|
|
|
{
|
|
|
|
|
return _store.ApiClients.TryGetValue(ClientId, out var client)
|
|
|
|
|
? client
|
|
|
|
|
: null;
|
|
|
|
|
}
|
|
|
|
|
}
|