public void Test1() { var list = new WeightedList <BasicClass>(); list.Add(new BasicClass("a")); list.Add(new BasicClass("b")); list.Add(new BasicClass("c")); Assert.Equal(0, list.IndexOf(c => c.Name == "a")); Assert.Equal(1, list.IndexOf(c => c.Name == "b")); Assert.Equal(2, list.IndexOf(c => c.Name == "c")); var n = list.Get(c => c.Name == "a"); list.CheckConsistency(); Assert.Equal("a", n.Name); n = list.Get(c => c.Name == "c"); list.CheckConsistency(); Assert.Equal(1, list.IndexOf(n)); n = list.Get(c => c.Name == "c"); list.CheckConsistency(); Assert.Equal(0, list.IndexOf(n)); n = list.Get(c => c.Name == "c"); list.CheckConsistency(); n = list.Get(c => c.Name == "c"); list.CheckConsistency(); Assert.Equal(0, list.IndexOf(n)); }