Esempio n. 1
0
        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>());
        }
Esempio n. 2
0
        public void Comparer_NotEqual_False()
        {
            Test1 x = Test1.Value1, y = (Test1)(-1);

            Assert.That(Enumeration.Comparer <Test1>().Equals(x, y), Is.False);
        }
Esempio n. 3
0
 public void Comparer_NotEnum_Throws()
 {
     Assert.That(() => Enumeration.Comparer <int>(), Throws.ArgumentException);
 }
Esempio n. 4
0
        public void Comparer_Equal_True()
        {
            Test1 x = Test1.Value1, y = Test1.Value1;

            Assert.That(Enumeration.Comparer <Test1>().Equals(x, y), Is.True);
        }