public void AddWorksAfterCollect()
        {
            var wc = new WeakCollection <string>();

            {
                wc.Add(new string('a', 1));
                Assert.Equal("a", wc.First());
            }
            GCEx.CollectAndWait();
            Assert.True(wc.CapCount <= 1);
            //Assert.Equal(0, wc.Count);
            wc.Add(new string('b', 1));
            Assert.Equal(1, wc.Count);
            Assert.Equal("b", wc.First());
        }
        public void AddWorks()
        {
            var wc = new WeakCollection <string> {
                "test"
            };

            Assert.Equal("test", wc.First());
        }
        public void ClearWorksAfterCollect()
        {
            var wc = new WeakCollection <string>();

            {
                var a = new string('a', 1);
                wc.Add(a);
                Assert.Equal("a", wc.First());
            }
            GCEx.CollectAndWait();
            wc.Clear();
            Assert.Equal(0, wc.CapCount);
            Assert.False(wc.Any());
        }