9using System.Collections.Generic;
11using System.Threading;
22 private static AsyncLocal<Dictionary<string, string>> _testResults =
new AsyncLocal<Dictionary<string, string>>();
29 public static void Add(
string key,
string value)
31 _testResults.Value.Add(key, value);
41 _testResults.Value[key] = value;
51 if (!_testResults.Value.ContainsKey(key))
return string.Empty;
53 return _testResults.Value[key];
63 return _testResults.Value.ContainsKey(key);
71 if (_testResults.Value is
null) _testResults.Value =
new Dictionary<string, string>();
72 _testResults.Value.Clear();
Static dictionary-like class that offers similar functionality to GlobalContext This is used in tests...
static void Reinitialise()
Reinitialise the dictionary, clearing any existing results, ready for the next test
static string GetResult(string key)
Get a result of an operation from the underlying results dictionary
static void AddOrOverwrite(string key, string value)
Overwrite an item in the test results, to indicate an outcome of a particular operation
static bool ContainsResult(string key)
Get the existence of a result of an operation from the underlying results dictionary
static void Add(string key, string value)
Add an item to the test results, to indicate an outcome of a particular operation