Browse Source

Update Oracle

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
f55746aed2
  1. 1
      Src/Asp.Net/OracleTest/OracleTest.csproj
  2. 36
      Src/Asp.Net/OracleTest/UnitTest/ExpressionTest/Select.cs

1
Src/Asp.Net/OracleTest/OracleTest.csproj

@ -32,6 +32,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="SyntacticSugar, Version=2.4.1.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />

36
Src/Asp.Net/OracleTest/UnitTest/ExpressionTest/Select.cs

@ -21,7 +21,7 @@ namespace OrmTest.UnitTest
base.Begin();
for (int i = 0; i < base.Count; i++)
{
single();
single();
single2();
single3();
single4();
@ -37,7 +37,7 @@ namespace OrmTest.UnitTest
private void Multiple()
{
Expression<Func<Student, School, object>> exp = (it, school) => new Student() { Name = "a", Id = it.Id, SchoolId = school.Id, TestId = it.Id + 1 };
ExpressionContext expContext = new ExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.IsSingle = false;
expContext.Resolve(exp, ResolveExpressType.SelectMultiple);
var selectorValue = expContext.Result.GetString();
@ -45,7 +45,7 @@ namespace OrmTest.UnitTest
base.Check(
selectorValue,
pars,
@" @constant0 AS [Name] , [it].[Id] AS [Id] , [school].[Id] AS [SchoolId] , ( [it].[Id] + @Id1 ) AS [TestId] ",
@" @constant0 AS ""Name"" , ""it"".""Id"" AS ""Id"" , ""school"".""Id"" AS ""SchoolId"" , ( ""it"".""Id"" + @Id1 ) AS ""TestId"" ",
new List<SugarParameter>(){
new SugarParameter("@constant0","a"),
new SugarParameter("@Id1",1)
@ -55,7 +55,7 @@ namespace OrmTest.UnitTest
private void Multiple2()
{
Expression<Func<Student, School, object>> exp = (it, school) => new ViewModelStudent3() { SchoolName=school.Name,Id=SqlFunc.GetSelfAndAutoFill(it.Id) };
ExpressionContext expContext = new ExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.IsSingle = false;
expContext.Resolve(exp, ResolveExpressType.SelectMultiple);
var selectorValue = expContext.Result.GetString();
@ -63,7 +63,7 @@ namespace OrmTest.UnitTest
base.Check(
selectorValue,
pars,
@" [school].[Name] AS [SchoolName] ,it.*",
@" ""school"".""Name"" AS ""SchoolName"" ,it.*",
new List<SugarParameter>(){
},
@ -74,7 +74,7 @@ namespace OrmTest.UnitTest
private void MultipleDynamic()
{
Expression<Func<Student, School, object>> exp = (it, school) => new { Name = "a", Id = it.Id / 2, SchoolId = school.Id };
ExpressionContext expContext = new ExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.IsSingle = false;
expContext.Resolve(exp, ResolveExpressType.SelectMultiple);
var selectorValue = expContext.Result.GetString();
@ -82,7 +82,7 @@ namespace OrmTest.UnitTest
base.Check(
selectorValue,
pars,
@" @constant0 AS [Name] , ( [it].[Id] / @Id1 ) AS [Id] , [school].[Id] AS [SchoolId] ",
@" @constant0 AS ""Name"" , ( ""it"".""Id"" / @Id1 ) AS ""Id"" , ""school"".""Id"" AS ""SchoolId"" ",
new List<SugarParameter>(){
new SugarParameter("@constant0","a"),
new SugarParameter("@Id1", 2)},
@ -92,14 +92,14 @@ namespace OrmTest.UnitTest
{
int p = 1;
Expression<Func<Student, object>> exp = it => new Student() { Name = "a", Id = it.Id, SchoolId = p,TestId=it.Id+11 };
ExpressionContext expContext = new ExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.Resolve(exp, ResolveExpressType.SelectSingle);
var selectorValue = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(
selectorValue,
pars,
@" @constant0 AS [Name] , [Id] AS [Id] , @constant1 AS [SchoolId] , ( [Id] + @Id2 ) AS [TestId] ",
@" @constant0 AS ""Name"" , ""Id"" AS ""Id"" , @constant1 AS ""SchoolId"" , ( ""Id"" + @Id2 ) AS ""TestId"" ",
new List<SugarParameter>(){
new SugarParameter("@constant0","a"),
new SugarParameter("@constant1",1),
@ -109,14 +109,14 @@ namespace OrmTest.UnitTest
private void single2(int p=1)
{
Expression<Func<Student, object>> exp = it => new Student() { Name = "a", Id = it.Id, SchoolId = p, TestId = it.Id + 11 };
ExpressionContext expContext = new ExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.Resolve(exp, ResolveExpressType.SelectSingle);
var selectorValue = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(
selectorValue,
pars,
@" @constant0 AS [Name] , [Id] AS [Id] , @constant1 AS [SchoolId] , ( [Id] + @Id2 ) AS [TestId] ",
@" @constant0 AS ""Name"" , ""Id"" AS ""Id"" , @constant1 AS ""SchoolId"" , ( ""Id"" + @Id2 ) AS ""TestId"" ",
new List<SugarParameter>(){
new SugarParameter("@constant0","a"),
new SugarParameter("@constant1",1),
@ -126,25 +126,25 @@ namespace OrmTest.UnitTest
private void single3(int p = 1)
{
Expression<Func<Student, object>> exp = it => new DataTestInfo() { Datetime1=DateTime.Now, String=it.Name};
ExpressionContext expContext = new ExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.Resolve(exp, ResolveExpressType.SelectSingle);
var selectorValue = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(
@" @constant0 AS [Datetime1] , [Name] AS [String] ", null,selectorValue,null,
@" @constant0 AS ""Datetime1"" , ""Name"" AS ""String"" ", null,selectorValue,null,
"Select.single3 Error");
}
private void single4(int p = 1)
{
Expression<Func<Student, object>> exp = it => it.CreateTime.HasValue;
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.IsSingle = false;
expContext.Resolve(exp, ResolveExpressType.WhereMultiple);
var selectorValue = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(
@"( [it].[CreateTime]<>'' AND [it].[CreateTime] IS NOT NULL )", null, selectorValue, null,
@"( ""it"".""CreateTime""<>'' AND ""it"".""CreateTime"" IS NOT NULL )", null, selectorValue, null,
"Select.single4 Error");
}
@ -152,7 +152,7 @@ namespace OrmTest.UnitTest
{
var p =(DateTime?) DateTime.Now;
Expression<Func<Student, object>> exp = it => p.HasValue;
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.IsSingle = false;
expContext.Resolve(exp, ResolveExpressType.WhereMultiple);
var selectorValue = expContext.Result.GetString();
@ -168,14 +168,14 @@ namespace OrmTest.UnitTest
{
string a = "a";
Expression<Func<Student, object>> exp = it => new { x = it.Id, shoolid = 1, name = a,p=it.Id*2 };
ExpressionContext expContext = new ExpressionContext();
OracleExpressionContext expContext = new OracleExpressionContext();
expContext.Resolve(exp, ResolveExpressType.SelectSingle);
var selectorValue = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(
selectorValue,
pars,
@" [Id] AS [x] , @constant0 AS [shoolid] , @constant1 AS [name] , ( [Id] * @Id2 ) AS [p] ",
@" ""Id"" AS ""x"" , @constant0 AS ""shoolid"" , @constant1 AS ""name"" , ( ""Id"" * @Id2 ) AS ""p"" ",
new List<SugarParameter>(){
new SugarParameter("@constant0",1),
new SugarParameter("@constant1","a"),

Loading…
Cancel
Save