Add SqlFunc.ToTime

This commit is contained in:
sunkaixuan
2017-07-08 02:02:58 +08:00
parent f8c5aef4c5
commit 8d5b8a717d
5 changed files with 36 additions and 0 deletions

View File

@@ -70,6 +70,7 @@ namespace OrmTest.UnitTest
Substring();
Replace();
Length();
Time();
}
base.End("Method Test");
}
@@ -111,6 +112,21 @@ namespace OrmTest.UnitTest
}, "Length error");
}
private void Time()
{
TimeSpan s = TimeSpan.Parse("11:22:22");
Expression<Func<Student, bool>> exp = it => SqlFunc.ToTime("11:12:59")==s;
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
var value = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(value, pars, "(CAST(@MethodConst0 AS TIME) = @Const1 )", new List<SugarParameter>() {
new SugarParameter("@MethodConst0","11:12:59"),new SugarParameter("@Const1",s)
}, "Time error");
}
private void Replace()
{
var x2 = Guid.NewGuid();