public void Dictionary_Generic_Constructor_IDictionary(int count)
        {
            IDictionary <TKey, TValue> source = GenericIDictionaryFactory(count);
            var copied = new PooledDictionary <TKey, TValue>(source);

            Assert.Equal(source, copied);
            copied.Dispose();
        }
        public void Dictionary_Generic_Constructor_int_IEqualityComparer(int count)
        {
            IEqualityComparer <TKey> comparer = GetKeyIEqualityComparer();
            var dictionary = new PooledDictionary <TKey, TValue>(count, comparer);

            Assert.Equal(0, dictionary.Count);
            Assert.Equal(comparer, dictionary.Comparer);
            dictionary.Dispose();
        }
        public void Dictionary_Generic_Constructor_IEqualityComparer(int count)
        {
            IEqualityComparer <TKey>   comparer = GetKeyIEqualityComparer();
            IDictionary <TKey, TValue> source   = GenericIDictionaryFactory(count);
            var copied = new PooledDictionary <TKey, TValue>(source, comparer);

            Assert.Equal(source, copied);
            Assert.Equal(comparer, copied.Comparer);
            copied.Dispose();
        }
        public void Dictionary_Generic_ValueCollection_GetEnumerator(int count)
        {
            var dictionary = new PooledDictionary <string, string>();
            int seed       = 13453;

            while (dictionary.Count < count)
            {
                dictionary.Add(CreateT(seed++), CreateT(seed++));
            }
            dictionary.Values.GetEnumerator();
            dictionary.Dispose();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Dispose and clear component data
        /// </summary>
        public void Dispose()
        {
            Array.Clear(ComponentTypes, 0, ComponentTypes.Length);
            entities.Clear();
            foreach (var component in Components.Values)
            {
                component.Dispose();
            }

            Components.Clear();

            entityToIndex.Dispose();
            entities.Dispose();
            Components.Dispose();
        }
        protected override void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                _coreAnalysisData.Dispose();
                _coreAnalysisData = null !;
            }

            base.Dispose(disposing);
        }
Exemplo n.º 7
0
        public static void OutOfBoundsRegression()
        {
            var dictionary = new PooledDictionary <string, string>();

            foreach (var item in TestData.GetData())
            {
                var operation = item.Item1;
                var keyBase64 = item.Item2;

                var key = keyBase64.Length > 0 ? GetString(Convert.FromBase64String(keyBase64)) : string.Empty;

                if (operation == InputAction.Add)
                {
                    dictionary[key] = key;
                }
                else if (operation == InputAction.Delete)
                {
                    dictionary.Remove(key);
                }
            }

            dictionary.Dispose();
        }
Exemplo n.º 8
0
        private bool disposedValue = false; // To detect redundant calls

        void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    GC.SuppressFinalize(this);
                }

                unknownGlobalAssignmentsPooled?.Dispose();
                unknownAssignmentsPooled?.Dispose();
                if (unknownBlocksPooled != null)
                {
                    foreach (var kvp in unknownBlocksPooled)
                    {
                        kvp.Value?.Dispose();
                    }

                    unknownBlocksPooled.Dispose();
                }

                disposedValue = true;
            }
        }
Exemplo n.º 9
0
 public void GlobalCleanup()
 {
     pooled?.Dispose();
 }
Exemplo n.º 10
0
 public void GlobalCleanup()
 {
     dict?.Dispose();
 }