Пример #1
0
 private static bool AppliedStyleIdsAreMatchedStyleIds(LinkedHashSet <ISelector> appliedMatchingStyles, LinkedHashSet <ISelector> matchingStyles)
 {
     return(matchingStyles == appliedMatchingStyles ||
            (
                matchingStyles != null &&
                appliedMatchingStyles != null &&
                matchingStyles.SequenceEqual(appliedMatchingStyles)
            ));
 }
Пример #2
0
        public void SetComparer_SequenceEqualTests()
        {
            SCG.List <T> objects = new SCG.List <T>()
            {
                CreateT(1), CreateT(2), CreateT(3), CreateT(4), CreateT(5), CreateT(6)
            };

            var set = new LinkedHashSet <LinkedHashSet <T> >()
            {
                new LinkedHashSet <T> {
                    objects[0], objects[1], objects[2]
                },
                new LinkedHashSet <T> {
                    objects[3], objects[4], objects[5]
                }
            };

            var noComparerSet = new LinkedHashSet <LinkedHashSet <T> >()
            {
                new LinkedHashSet <T> {
                    objects[0], objects[1], objects[2]
                },
                new LinkedHashSet <T> {
                    objects[3], objects[4], objects[5]
                }
            };

            var comparerSet = new LinkedHashSet <LinkedHashSet <T> >(SetEqualityComparer <T> .Default)
            {
                new LinkedHashSet <T> {
                    objects[0], objects[1], objects[2]
                },
                new LinkedHashSet <T> {
                    objects[3], objects[4], objects[5]
                }
            };

            Assert.True(noComparerSet.SequenceEqual(set)); // Unlike the .NET LinkedHashSet, ours is structurally equatable by default
            Assert.True(noComparerSet.SequenceEqual(set, SetEqualityComparer <T> .Default));
            Assert.True(comparerSet.SequenceEqual(set));   // Unlike the .NET LinkedHashSet, ours is structurally equatable by default
        }