public void ConstantTest_DateTime() { LinqToSparqlExpTranslator<Track> target = new LinqToSparqlExpTranslator<Track>(); target.TypeTranslator = new XsdtTypeConverter(); ConstantExpression ce = Expression.Constant(new DateTime(2002, 03, 04, 05, 06, 07)); StringBuilder sb = new StringBuilder(); target.StringBuilder = sb; target.Constant(ce); string actualResult = sb.ToString(); string expectedResult = "\"2002-03-04T05:06:07+11:00\"^^xsdt:dateTime"; Assert.AreEqual(expectedResult, actualResult); }
public void ConstantTest_decimal() { LinqToSparqlExpTranslator<Track> target = new LinqToSparqlExpTranslator<Track>(); target.TypeTranslator = new XsdtTypeConverter(); ConstantExpression ce = Expression.Constant((decimal)3.14); // string StringBuilder sb = new StringBuilder(); target.StringBuilder = sb; target.Constant(ce); string actualResult = sb.ToString(); string expectedResult = "3.14^^xsdt:decimal"; Assert.AreEqual(expectedResult, actualResult); }
public void ConstantTest_string() { LinqToSparqlExpTranslator<Track> target = new LinqToSparqlExpTranslator<Track>(); target.TypeTranslator = new XsdtTypeConverter(); ConstantExpression ce = Expression.Constant("hello world"); // string StringBuilder sb = new StringBuilder(); target.StringBuilder = sb; target.Constant(ce); string actualResult = sb.ToString(); string expectedResult = "\"hello world\""; Assert.AreEqual(expectedResult, actualResult); }