コード例 #1
0
        public void ClearTest()
        {
            var totalCount = _list.Count;

            var count = _customers.Count;

            _customers.Clear();

            Assert.Equal(0, _customers.Count);
            Assert.Equal(totalCount -= count, _list.Count);

            count = _employees.Count;
            _employees.Clear();

            Assert.Equal(0, _employees.Count);
            Assert.Equal(totalCount -= count, _list.Count);

            _customers.Add(new Customer()
            {
                Name = "New Customer",
            });

            Assert.Equal(1, _customers.Count);

            _list.Clear();
            Assert.Equal(0, _customers.Count);
            Assert.Equal(0, _list.Count);
        }
コード例 #2
0
        protected override void dispose(bool disposeManagedResources)
        {
            Write("*-*-* Disseminate Shutdown Complete.");

            if (!isDisposed)
            {
                if (disposeManagedResources)
                {
                    // Dispose managed resources.
                    // dispose of all the logs
                    foreach (IDisposable o in logList.Values)
                    {
                        o.Dispose();
                    }

                    logList.Clear();
                }

                // There are no unmanaged resources to release, but
                // if we add them, they need to be released here.
            }

            // If it is available, make the call to the
            // base class's Dispose(Boolean) method
            base.dispose(disposeManagedResources);
        }