Ejemplo n.º 1
0
        public void ShouldAllowCreatingUuidFucntionCall()
        {
            // when
            IriExpression uuid = Builder.UUID();

            // then
            Assert.IsTrue(uuid.Expression is UUIDFunction);
        }
Ejemplo n.º 2
0
        public void CanCreateOldDatatypeFunctionWithLiteralParameter()
        {
            // given
            LiteralExpression literal = new TypedLiteralExpression <string>("1000");

            // when
            IriExpression lang = Builder.Datatype(literal);

            // then
            Assert.IsTrue(lang.Expression is DataTypeFunction);
            Assert.AreSame(literal.Expression, lang.Expression.Arguments.ElementAt(0));
        }
Ejemplo n.º 3
0
        public void CanCreateOldDatatypeFunctionWithVariableParameter()
        {
            // given
            VariableExpression literal = new VariableExpression("s");

            // when
            IriExpression lang = Builder.Datatype(literal);

            // then
            Assert.IsTrue(lang.Expression is DataTypeFunction);
            Assert.AreSame(literal.Expression, lang.Expression.Arguments.ElementAt(0));
        }
Ejemplo n.º 4
0
        public void CanCreateStrFunctionWithIriLiteral()
        {
            // given
            var iri = new IriExpression(new Uri("urn:some:uri"));

            // when
            LiteralExpression str = Builder.Str(iri);

            // then
            Assert.IsTrue(str.Expression is StrFunction);
            Assert.AreSame(iri.Expression, str.Expression.Arguments.ElementAt(0));
        }
Ejemplo n.º 5
0
        public void ShouldAllowCreatingStrdtFunctionWithVariableAndIriExpressionParameters()
        {
            // given
            var expression    = new VariableExpression("literalVar");
            var iriExpression = new IriExpression(new Uri("http://example.com"));

            // when
            LiteralExpression literal = Builder.StrDt(expression, iriExpression);

            // then
            Assert.IsTrue(literal.Expression is StrDtFunction);
            Assert.AreSame(expression.Expression, literal.Expression.Arguments.ElementAt(0));
            Assert.AreSame(iriExpression.Expression, literal.Expression.Arguments.ElementAt(1));
        }
Ejemplo n.º 6
0
        public void ShouldAllowCreatingStrdtFunctionWithStringAndUriParameters()
        {
            // given
            var expression    = "literal".ToConstantTerm();
            var iriExpression = new IriExpression(new Uri("http://example.com"));

            // when
            LiteralExpression literal = Builder.StrDt("literal", new Uri("http://example.com"));

            // then
            Assert.IsTrue(literal.Expression is StrDtFunction);
            Assert.AreEqual(expression.ToString(), literal.Expression.Arguments.ElementAt(0).ToString());
            Assert.AreEqual(iriExpression.Expression.ToString(), literal.Expression.Arguments.ElementAt(1).ToString());
        }
Ejemplo n.º 7
0
        public void ShouldAllowCreatingStrdtFunctionWithLiteralExpressionAndUriParameters()
        {
            // given
            LiteralExpression expression = new LiteralExpression(new VariableTerm("S"));
            var iriExpression            = new IriExpression(new Uri("http://example.com"));

            // when
            LiteralExpression literal = Builder.StrDt(expression, new Uri("http://example.com"));

            // then
            Assert.IsTrue(literal.Expression is StrDtFunction);
            Assert.AreSame(expression.Expression, literal.Expression.Arguments.ElementAt(0));
            Assert.AreEqual(iriExpression.Expression.ToString(), literal.Expression.Arguments.ElementAt(1).ToString());
        }
Ejemplo n.º 8
0
        public void CanCreateEqualityComparisonBetweenRdfTerms()
        {
            // given
            IriExpression left  = new IriExpression(new Uri("urn:unit:test1"));
            IriExpression right = new IriExpression(new Uri("urn:unit:test1"));

            // when
            var areEqual = (left == right).Expression;

            // then
            Assert.IsTrue(areEqual is EqualsExpression);
            Assert.AreSame(left.Expression, areEqual.Arguments.ElementAt(0));
            Assert.AreSame(right.Expression, areEqual.Arguments.ElementAt(1));
        }