mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 02:08:21 +08:00
d39f53f1f0
Also, remove nullable disable annotation for all using classes. Setting store can be nullable because `RulesetConfigManager()` can accept null setting store.
20 lines
812 B
C#
20 lines
812 B
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Collections.Concurrent;
|
|
using osu.Game.Rulesets;
|
|
using osu.Game.Rulesets.Configuration;
|
|
|
|
namespace osu.Game.Tests.Rulesets
|
|
{
|
|
/// <summary>
|
|
/// Test implementation of a <see cref="IRulesetConfigCache"/>, which ensures isolation between test scenes.
|
|
/// </summary>
|
|
public class TestRulesetConfigCache : IRulesetConfigCache
|
|
{
|
|
private readonly ConcurrentDictionary<string, IRulesetConfigManager?> configCache = new ConcurrentDictionary<string, IRulesetConfigManager?>();
|
|
|
|
public IRulesetConfigManager? GetConfigFor(Ruleset ruleset) => configCache.GetOrAdd(ruleset.ShortName, _ => ruleset.CreateConfig(null));
|
|
}
|
|
}
|