示例#1
0
 public void ShouldHandleManyLeftValuesForRight()
 {
     var table = new WeakMultiTable<int, int>();
     table.Add(5, 0);
     table.Add(6, 0);
     Assert.AreEqual(2, table.GetAllForRight(0).Count());
 }
        public void ShouldHandleManyLeftValuesForRight()
        {
            var table = new WeakMultiTable <int, int>();

            table.Add(5, 0);
            table.Add(6, 0);
            Assert.AreEqual(2, table.GetAllForRight(0).Count());
        }
示例#3
0
        public void ShouldRemovePair()
        {
            var table = new WeakMultiTable<int, int>();
            table.Add(0, 0);
            table.Add(1, 1);

            Assert.AreEqual(1, table.GetAllForLeft(0).Count());
            Assert.AreEqual(1, table.GetAllForLeft(1).Count());

            table.RemovePair(0, 0);

            Assert.AreEqual(0, table.GetAllForLeft(0).Count());
            Assert.AreEqual(1, table.GetAllForLeft(1).Count());
        }
        public void ShouldRemovePair()
        {
            var table = new WeakMultiTable <int, int>();

            table.Add(0, 0);
            table.Add(1, 1);

            Assert.AreEqual(1, table.GetAllForLeft(0).Count());
            Assert.AreEqual(1, table.GetAllForLeft(1).Count());

            table.RemovePair(0, 0);

            Assert.AreEqual(0, table.GetAllForLeft(0).Count());
            Assert.AreEqual(1, table.GetAllForLeft(1).Count());
        }
        private WeakReference GenerateWeakReferenceAndInsertIntoTable(WeakMultiTable <NotSoWeakClass, int> table)
        {
            var item = new NotSoWeakClass();

            table.Add(item, 0);
            return(new WeakReference(item));
        }
示例#6
0
 private WeakReference GenerateWeakReferenceAndInsertIntoTable(WeakMultiTable<NotSoWeakClass, int> table)
 {
     var item = new NotSoWeakClass();
     table.Add(item, 0);
     return new WeakReference(item);
 }