예제 #1
0
        public void EqualsComparesPatterns()
        {
            PatternGroup group1 = new PatternGroup();
            PatternGroup group2 = new PatternGroup();
            PatternGroup group3 = new PatternGroup();

            group1.AddPattern(new Pattern(new UriRef("http://example.com/subject"), new UriRef("http://example.com/predicate"), new Variable("var")));
            group2.AddPattern(new Pattern(new UriRef("http://example.com/subject"), new UriRef("http://example.com/predicate"), new Variable("var")));
            group3.AddPattern(new Pattern(new UriRef("http://example.com/other"), new UriRef("http://example.com/predicate"), new Variable("var")));

            Assert.IsTrue(group1.Equals(group2), "PatternGroup1 should equal group2");
            Assert.IsTrue(!group1.Equals(group3), "PatternGroup1 should not equal group3");
        }
예제 #2
0
        public void EqualsComparesConstraints()
        {
            PatternGroup group1 = new PatternGroup();
            PatternGroup group2 = new PatternGroup();
            PatternGroup group3 = new PatternGroup();

            group1.AddConstraint(new Constraint(new VariableExpression(new Variable("var"))));
            group2.AddConstraint(new Constraint(new VariableExpression(new Variable("var"))));
            group3.AddConstraint(new Constraint(new VariableExpression(new Variable("other"))));

            Assert.IsTrue(group1.Equals(group2), "PatternGroup1 should equal group2");
            Assert.IsTrue(!group1.Equals(group3), "PatternGroup1 should not equal group3");
        }