static CurrencyCache() { int cacheCapacity = Enum.GetNames(typeof(CurrencyIsoCode)).Length; int concurrency = Environment.ProcessorCount * 4; _byIsoSymbol = new ConcurrentDictionary <string, Currency>(concurrency, cacheCapacity, StringComparer.OrdinalIgnoreCase); // we use a fast comparer as we have quite a few enum keys _byIsoCode = new ConcurrentDictionary <CurrencyIsoCode, Currency>(concurrency, cacheCapacity, Enumeration.Comparer <CurrencyIsoCode>()); }
public void Comparer_NotEqual_False() { Test1 x = Test1.Value1, y = (Test1)(-1); Assert.That(Enumeration.Comparer <Test1>().Equals(x, y), Is.False); }
public void Comparer_NotEnum_Throws() { Assert.That(() => Enumeration.Comparer <int>(), Throws.ArgumentException); }
public void Comparer_Equal_True() { Test1 x = Test1.Value1, y = Test1.Value1; Assert.That(Enumeration.Comparer <Test1>().Equals(x, y), Is.True); }