You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/Recyclarr.TestLibrary/Autofac/StubAutofacIndex.cs

23 lines
550 B

using System.Diagnostics.CodeAnalysis;
using Autofac.Features.Indexed;
namespace Recyclarr.TestLibrary.Autofac;
public class StubAutofacIndex<TKey, TValue> : IIndex<TKey, TValue>
where TKey : notnull
{
private readonly Dictionary<TKey, TValue> _values = new();
public void Add(TKey key, TValue value)
{
_values.Add(key, value);
}
public bool TryGetValue(TKey key, [UnscopedRef] out TValue value)
{
return _values.TryGetValue(key, out value!);
}
public TValue this[TKey key] => _values[key];
}