adding
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using OwnerNumberMigration.ValueParsing;
|
||||
|
||||
namespace OwnerNumberMigrationTest.TestDoubles;
|
||||
|
||||
public class FakeParsingStrategy<T> : IValueParsingStrategy<T>
|
||||
{
|
||||
public IDictionary<string, T> Values { get; } = new Dictionary<string, T>();
|
||||
|
||||
private readonly Func<T> _newT;
|
||||
|
||||
public FakeParsingStrategy(Func<T> newT)
|
||||
{
|
||||
this._newT = newT;
|
||||
}
|
||||
|
||||
public T Parse(string value) => Values.TryGetValue(value, out var parsed)
|
||||
? parsed
|
||||
: _newT();
|
||||
}
|
||||
Reference in New Issue
Block a user