public void SetComparer_SetEqualsTests() { List <T> objects = new List <T>() { CreateT(1), CreateT(2), CreateT(3), CreateT(4), CreateT(5), CreateT(6) }; var set = new PooledSet <PooledSet <T> >() { RegisterForDispose(new PooledSet <T> { objects[0], objects[1], objects[2] }), RegisterForDispose(new PooledSet <T> { objects[3], objects[4], objects[5] }) }; RegisterForDispose(set); var noComparerSet = new PooledSet <PooledSet <T> >() { RegisterForDispose(new PooledSet <T> { objects[0], objects[1], objects[2] }), RegisterForDispose(new PooledSet <T> { objects[3], objects[4], objects[5] }) }; RegisterForDispose(noComparerSet); var comparerSet1 = new PooledSet <PooledSet <T> >(PooledSet <T> .CreateSetComparer()) { RegisterForDispose(new PooledSet <T> { objects[0], objects[1], objects[2] }), RegisterForDispose(new PooledSet <T> { objects[3], objects[4], objects[5] }) }; RegisterForDispose(comparerSet1); var comparerSet2 = new PooledSet <PooledSet <T> >(PooledSet <T> .CreateSetComparer()) { RegisterForDispose(new PooledSet <T> { objects[3], objects[4], objects[5] }), RegisterForDispose(new PooledSet <T> { objects[0], objects[1], objects[2] }) }; RegisterForDispose(comparerSet2); Assert.False(noComparerSet.SetEquals(set)); Assert.True(comparerSet1.SetEquals(set)); Assert.True(comparerSet2.SetEquals(set)); }