Beispiel #1
0
        public void EqualityComparer_Node_VB()
        {
            var comparer = new VisualBasicSyntaxNodeEqualityComparer <VisualBasic.StatementSyntax>();

            var result = comparer.Equals(methods_VB.Method1.First(), methods_VB.Method2.First());

            result.Should().BeTrue();

            result = comparer.Equals(methods_VB.Method1.First(), methods_VB.Method3.First());
            result.Should().BeFalse();

            var hashSet = new HashSet <VisualBasic.StatementSyntax>(new[] { methods_VB.Method1.First(), methods_VB.Method2.First(), methods_VB.Method3.First() }, comparer);

            hashSet.Count.Should().Be(2);
            hashSet.Contains(methods_VB.Method1.First()).Should().BeTrue();
            hashSet.Contains(methods_VB.Method4.First()).Should().BeFalse();
        }
Beispiel #2
0
        public void EqualityComparer_List_VB()
        {
            var comparer = new VisualBasicSyntaxNodeEqualityComparer <VisualBasic.StatementSyntax>();

            var result = comparer.Equals(methods_VB.Method1, methods_VB.Method2);

            result.Should().BeTrue();

            result = comparer.Equals(methods_VB.Method1, methods_VB.Method3);
            result.Should().BeFalse();

            var hashSet = new HashSet <SyntaxList <VisualBasic.StatementSyntax> >(new[] { methods_VB.Method1, methods_VB.Method2, methods_VB.Method3 }, comparer);

            hashSet.Count.Should().Be(2);
            hashSet.Contains(methods_VB.Method1).Should().BeTrue();
            hashSet.Contains(methods_VB.Method4).Should().BeFalse();
        }
Beispiel #3
0
        public void EqualityComparer_List_VB()
        {
            var comparer = new VisualBasicSyntaxNodeEqualityComparer <VisualBasic.StatementSyntax>();

            var result = comparer.Equals(vbMethods.Method1, vbMethods.Method2);

            result.Should().BeTrue();

            result = comparer.Equals(vbMethods.Method1, vbMethods.Method3);
            result.Should().BeFalse();

            var hashSet = new HashSet <SyntaxList <VisualBasic.StatementSyntax> >(new[] { vbMethods.Method1, vbMethods.Method2, vbMethods.Method3 }, comparer);

            hashSet.Should().HaveCount(2);
            hashSet.Should().Contain(vbMethods.Method1);
            hashSet.Should().NotContain(vbMethods.Method4);
        }