Add unit test

This commit is contained in:
sunkaixuan 2022-06-07 19:40:05 +08:00
parent 563c27e9a6
commit 0803500d90
7 changed files with 983 additions and 0 deletions

View File

@ -95,6 +95,11 @@
<Compile Include="Models\OrderItem.cs" /> <Compile Include="Models\OrderItem.cs" />
<Compile Include="Demo\Demo0_SqlSugarClient.cs" /> <Compile Include="Demo\Demo0_SqlSugarClient.cs" />
<Compile Include="Models\ViewOrder.cs" /> <Compile Include="Models\ViewOrder.cs" />
<Compile Include="UnitTest\Models\DSPersonScheduleModel.cs" />
<Compile Include="UnitTest\Models\PersonScheduleParam.cs" />
<Compile Include="UnitTest\Models\T_BAS_AIRPORT.cs" />
<Compile Include="UnitTest\Models\V_PERSON_SCHEDULE_A.cs" />
<Compile Include="UnitTest\UCustom023.cs" />
<Compile Include="UnitTest\UCustom22.cs" /> <Compile Include="UnitTest\UCustom22.cs" />
<Compile Include="UnitTest\UCustom021.cs" /> <Compile Include="UnitTest\UCustom021.cs" />
<Compile Include="UnitTest\UByteArray.cs" /> <Compile Include="UnitTest\UByteArray.cs" />

View File

@ -31,6 +31,7 @@ namespace OrmTest
} }
public static void Init() public static void Init()
{ {
UCustom023.Init();
UCustom22.Init(); UCustom22.Init();
UByteArray.Init(); UByteArray.Init();
UCustom021.Inti(); UCustom021.Inti();

View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ICrewApi.Models
{
public class DSPersonScheduleModel
{
public string AC_REG { get; set; }
public string AC_TYPE { get; set; }
public string ARRIVAL_AIRPORT { get; set; }
public DateTime ATA { get; set; }
public DateTime ATD { get; set; }
public long CREW_LINK_LINE { get; set; }
public long CREW_PAIRING_LINE { get; set; }
public string DDO_CODE { get; set; }
public string DEPARTURE_AIRPORT { get; set; }
public string D_OR_I { get; set; }
public string FLIGHT_COM { get; set; }
public long FLIGHT_ID { get; set; }
public string FLIGHT_VOYAGE { get; set; }
public DateTime FROM_DATE { get; set; }
public string MODIFY_REASON { get; set; }
public string PAIRINGVOYAGE { get; set; }
public string P_CODE { get; set; }
public string RANK_NO { get; set; }
public string REASON { get; set; }
public string SCHEDULE_TYPE { get; set; }
public DateTime TA { get; set; }
public DateTime TD { get; set; }
public DateTime TIME_FROM_PORT { get; set; }
public DateTime TIME_TO_PORT { get; set; }
public DateTime TO_DATE { get; set; }
public string FLG_CS { get; set; }
public string REMARKS { get; set; }
public int FLY_HOURS { get; set; }
/// <summary>
/// 前车时间
/// </summary>
public short? PREVIOUS_RIDE_TIME { set; get; }
/// <summary>
/// 后车程时间
/// </summary>
public short? REAR_RIDE_TIME { set; get; }
public string DEPA_AIRPORT { get; set; }
public string DEPA_NATIVE { get; set; }
public int DEPA_RESTTIME { get; set; }
public int DEPA_ZONE_TIME { get; set; }
/// <summary>
/// 起飞机场类别
/// </summary>
public string DEPA_TYPE { get; set; }
/// <summary>
/// 落地机场类别
/// </summary>
public string ARRI_TYPE { get; set; }
public string ARRI_AIRPORT { get; set; }
public string ARRI_NATIVE { get; set; }
public int ARRI_RESTTIME { get; set; }
public int ARRI_ZONE_TIME { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ICrewApi.Models
{
public class PersonScheduleParam
{
public List<string> P_CODE { get; set; }
public DateTime STARTDATE { get; set; }
public DateTime ENDDATE { get; set; }
public string MODULEFLAG { get; set; }
}
}

View File

@ -0,0 +1,553 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace ICrewApi.Entity
{
///<summary>
///机场信息
///</summary>
[SugarTable("T_BAS_AIRPORT")]
public partial class T_BAS_AIRPORT
{
public T_BAS_AIRPORT(){
}
/// <summary>
/// Desc:机场四码
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true)]
public string AIRPORT_4CODE {get;set;}
/// <summary>
/// Desc:机场三字码
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true)]
public string AIRPORT_3CODE {get;set;}
/// <summary>
/// Desc:机场中文名称
/// Default:
/// Nullable:True
/// </summary>
public string CHINESE_NAME {get;set;}
/// <summary>
/// Desc:机场英文名称
/// Default:
/// Nullable:True
/// </summary>
public string ENGLISH_NAME {get;set;}
/// <summary>
/// Desc:机场中文简称
/// Default:
/// Nullable:True
/// </summary>
public string CHINESE_ABBR {get;set;}
/// <summary>
/// Desc:所在城市三字码
/// Default:
/// Nullable:True
/// </summary>
public string CITY_3CODE {get;set;}
/// <summary>
/// Desc:所在城市中文名称
/// Default:
/// Nullable:True
/// </summary>
public string CITY_CH_NAME {get;set;}
/// <summary>
/// Desc:国际/国内(D国内I国际R地区)
/// Default:
/// Nullable:True
/// </summary>
public string D_OR_I {get;set;}
/// <summary>
/// Desc:国家(字典)
/// Default:
/// Nullable:True
/// </summary>
public string NATIVE {get;set;}
/// <summary>
/// Desc:时差
/// Default:
/// Nullable:True
/// </summary>
public short? ZONE_TIME {get;set;}
/// <summary>
/// Desc:飞行标准报道时间
/// Default:
/// Nullable:True
/// </summary>
public short? IN_TIME {get;set;}
/// <summary>
/// Desc:飞行标准离场时间
/// Default:
/// Nullable:True
/// </summary>
public short? OUT_TIME {get;set;}
/// <summary>
/// Desc:报务区域(字典)X
/// Default:
/// Nullable:True
/// </summary>
public string RADIO_AREA {get;set;}
/// <summary>
/// Desc:是否外籍可飞(Y/N)X
/// Default:
/// Nullable:True
/// </summary>
public string FOREIGN_YN {get;set;}
/// <summary>
/// Desc:是否有休息场所(Y/N)
/// Default:
/// Nullable:True
/// </summary>
public string REST_YN {get;set;}
/// <summary>
/// Desc:ICAO(3,4,5,6,7,8级)
/// Default:
/// Nullable:True
/// </summary>
public short? A_ICAO {get;set;}
/// <summary>
/// Desc:机场类型(1类2类3类=特殊、高原、高高原)
/// Default:
/// Nullable:True
/// </summary>
public string A_CLS {get;set;}
/// <summary>
/// Desc:机场有效月数
/// Default:
/// Nullable:True
/// </summary>
public short? A_CLS_CYCLE {get;set;}
/// <summary>
/// Desc:机场仪表等级(CAT-I CAT-II RVR)
/// Default:
/// Nullable:True
/// </summary>
public string A_CATS {get;set;}
/// <summary>
/// Desc:程序方式-传统,RNP-AR
/// Default:
/// Nullable:True
/// </summary>
public string A_RNPAR {get;set;}
/// <summary>
/// Desc:长跑道/L 短跑道/S
/// Default:
/// Nullable:True
/// </summary>
public string A_RAILWAY {get;set;}
/// <summary>
/// Desc:操作人
/// Default:
/// Nullable:True
/// </summary>
public string OPER {get;set;}
/// <summary>
/// Desc:操作时间
/// Default:
/// Nullable:True
/// </summary>
public DateTime? OP_TIME {get;set;}
/// <summary>
/// Desc:备注
/// Default:
/// Nullable:True
/// </summary>
public string REMARKS {get;set;}
/// <summary>
/// Desc:IP地址
/// Default:
/// Nullable:True
/// </summary>
public string OPER_IP {get;set;}
/// <summary>
/// Desc:主机名
/// Default:
/// Nullable:True
/// </summary>
public string OPER_HOST {get;set;}
/// <summary>
/// Desc:特殊机场放飞
/// Default:
/// Nullable:True
/// </summary>
public string SPECIAL_YN {get;set;}
/// <summary>
/// Desc:报务机场放飞X
/// Default:
/// Nullable:True
/// </summary>
public string RADIO_YN {get;set;}
/// <summary>
/// Desc:外站值班人
/// Default:
/// Nullable:True
/// </summary>
public string DUTY_PERSON {get;set;}
/// <summary>
/// Desc:外站值班电话
/// Default:
/// Nullable:True
/// </summary>
public string DUTY_TEL {get;set;}
/// <summary>
/// Desc:长航线Y/N
/// Default:
/// Nullable:True
/// </summary>
public string A_DISTANCE {get;set;}
/// <summary>
/// Desc:机长单飞区域(字典)X
/// Default:
/// Nullable:True
/// </summary>
public string CAPT_AREA {get;set;}
/// <summary>
/// Desc:是否需要提前报备
/// Default:
/// Nullable:True
/// </summary>
public string CERT_YN {get;set;}
/// <summary>
/// Desc:开车时间
/// Default:
/// Nullable:True
/// </summary>
public short? CAR_TIME {get;set;}
/// <summary>
/// Desc:特殊机场适用分公司串
/// Default:
/// Nullable:True
/// </summary>
public string SPECIAL_FILIALES {get;set;}
/// <summary>
/// Desc:休息时间(分钟)
/// Default:
/// Nullable:True
/// </summary>
public short? RESTTIME {get;set;}
/// <summary>
/// Desc:特殊机场放飞所属分公司
/// Default:
/// Nullable:True
/// </summary>
public string SPECIAL_OWNER {get;set;}
/// <summary>
/// Desc:领取武器包
/// Default:
/// Nullable:True
/// </summary>
public string WEAPONS_YN {get;set;}
/// <summary>
/// Desc:是否空警特殊机场
/// Default:
/// Nullable:True
/// </summary>
public string SPECIAL_POLIC {get;set;}
/// <summary>
/// Desc:机场类别 1:一类高原 2二类高原 3三类高原 ,来自t7501
/// Default:
/// Nullable:True
/// </summary>
public string AIRPORT_TYPE {get;set;}
/// <summary>
/// Desc:机场类别4港澳地区 5台湾地区 6日韩地区 7东南亚地区 8其他国际地区,来自t7501
/// Default:
/// Nullable:True
/// </summary>
public string AIRPORT_I {get;set;}
/// <summary>
/// Desc:是否双机长航线
/// Default:
/// Nullable:False
/// </summary>
public string TWIN_CAPTAIN_YN {get;set;}
/// <summary>
/// Desc:是否支持任务书打印
/// Default:
/// Nullable:False
/// </summary>
public string FTBPRINT {get;set;}
/// <summary>
/// Desc:机场可飞机型(飞管使用)
/// Default:
/// Nullable:True
/// </summary>
public string AC_TYPES {get;set;}
/// <summary>
/// Desc:有值代表为带飞对标机场,如些机场带队,则其他相同类型的机场的带飞标准设置为此字段值
/// Default:
/// Nullable:True
/// </summary>
public decimal? FNUMBER {get;set;}
/// <summary>
/// Desc:飞行标准进场时间
/// Default:
/// Nullable:True
/// </summary>
public short? REPORT_TIME {get;set;}
/// <summary>
/// Desc:飞行标准前车程时间
/// Default:
/// Nullable:True
/// </summary>
public short? PREVIOUS_RIDE_TIME_F {get;set;}
/// <summary>
/// Desc:飞行标准后车程时间
/// Default:
/// Nullable:True
/// </summary>
public short? REAR_RIDE_TIME_F {get;set;}
/// <summary>
/// Desc:乘务标准报道时间
/// Default:
/// Nullable:True
/// </summary>
public short? IN_TIME_C {get;set;}
/// <summary>
/// Desc:乘务标准进场时间
/// Default:
/// Nullable:True
/// </summary>
public short? REPORT_TIME_C {get;set;}
/// <summary>
/// Desc:乘务标准离场时间
/// Default:
/// Nullable:True
/// </summary>
public short? OUT_TIME_C {get;set;}
/// <summary>
/// Desc:乘务标准前车程时间
/// Default:
/// Nullable:True
/// </summary>
public short? PREVIOUS_RIDE_TIME_C {get;set;}
/// <summary>
/// Desc:乘务标准后车程时间
/// Default:
/// Nullable:True
/// </summary>
public short? REAR_RIDE_TIME_C {get;set;}
/// <summary>
/// Desc:空警标准报道时间
/// Default:
/// Nullable:True
/// </summary>
public short? IN_TIME_A {get;set;}
/// <summary>
/// Desc:空警标准进场时间
/// Default:
/// Nullable:True
/// </summary>
public short? REPORT_TIME_A {get;set;}
/// <summary>
/// Desc:空警标准离场时间
/// Default:
/// Nullable:True
/// </summary>
public short? OUT_TIME_A {get;set;}
/// <summary>
/// Desc:空警标准前车程时间
/// Default:
/// Nullable:True
/// </summary>
public short? PREVIOUS_RIDE_TIME_A {get;set;}
/// <summary>
/// Desc:空警标准后车程时间
/// Default:
/// Nullable:True
/// </summary>
public short? REAR_RIDE_TIME_A {get;set;}
/// <summary>
/// Desc:飞行标准前车程时间2
/// Default:
/// Nullable:True
/// </summary>
public short? PREVIOUS_RIDE_TIME_F2 {get;set;}
/// <summary>
/// Desc:飞行标准后车程时间2
/// Default:
/// Nullable:True
/// </summary>
public short? REAR_RIDE_TIME_F2 {get;set;}
/// <summary>
/// Desc:货机标准报道时间
/// Default:
/// Nullable:False
/// </summary>
public short IN_TIME_H {get;set;}
/// <summary>
/// Desc:货机标准进场时间
/// Default:
/// Nullable:False
/// </summary>
public short REPORT_TIME_H {get;set;}
/// <summary>
/// Desc:货机标准离场时间
/// Default:
/// Nullable:False
/// </summary>
public short OUT_TIME_H {get;set;}
/// <summary>
/// Desc:货机标准前车程时间
/// Default:
/// Nullable:False
/// </summary>
public short PREVIOUS_RIDE_TIME_H {get;set;}
/// <summary>
/// Desc:货机标准后车程时间
/// Default:
/// Nullable:False
/// </summary>
public short REAR_RIDE_TIME_H {get;set;}
/// <summary>
/// Desc:货机标准前车程时间2
/// Default:
/// Nullable:False
/// </summary>
public short PREVIOUS_RIDE_TIME_H2 {get;set;}
/// <summary>
/// Desc:货机标准后车程时间2
/// Default:
/// Nullable:False
/// </summary>
public short REAR_RIDE_TIME_H2 {get;set;}
/// <summary>
/// Desc:乘务标准国际报道时间
/// Default:
/// Nullable:True
/// </summary>
public short? IN_TIME_C_I {get;set;}
/// <summary>
/// Desc:空保标准国际报道时间
/// Default:
/// Nullable:True
/// </summary>
public short? IN_TIME_A_I {get;set;}
/// <summary>
/// Desc:日出裕度
/// Default:
/// Nullable:True
/// </summary>
public short? UP_MARGIN {get;set;}
/// <summary>
/// Desc:日落裕度
/// Default:
/// Nullable:True
/// </summary>
public short? DOWN_MARGIN {get;set;}
/// <summary>
/// Desc:是否一般高原机场
/// Default:
/// Nullable:True
/// </summary>
public string IS_YBGY_YN {get;set;}
/// <summary>
/// Desc:是否不校验夜航规则
/// Default:
/// Nullable:True
/// </summary>
public string IS_NO_CHECK_NIGHTAIR {get;set;}
/// <summary>
/// Desc:是否一般高原机场备注
/// Default:
/// Nullable:True
/// </summary>
public string IS_YBGY_YN_REMARK {get;set;}
/// <summary>
/// Desc:是否不校验夜航规则备注
/// Default:
/// Nullable:True
/// </summary>
public string IS_NO_NIGHTAIR_REMARK {get;set;}
/// <summary>
/// Desc:标识特殊机场(Y-是,N-否)-飞管用
/// Default:
/// Nullable:True
/// </summary>
public string SPECIAL_FLAG {get;set;}
}
}

View File

@ -0,0 +1,301 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace ICrewApi.Entity
{
///<summary>
///
///</summary>
[SugarTable("V_PERSON_SCHEDULE_A")]
public partial class V_PERSON_SCHEDULE_A
{
public V_PERSON_SCHEDULE_A(){
}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(SqlParameterDbType = System.Data.DbType.Date)]
public DateTime? FROM_DATE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(SqlParameterDbType = System.Data.DbType.Date)]
public DateTime? TO_DATE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? ACTION_FLY_HOURS {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? CREW_ID {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? CREW_IDR5 {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string AC_TYPE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string AC_REG {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string FLIGHT_COM {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string FLIGHT_VOYAGE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string PAIRINGVOYAGE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? FLIGHT_ID {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? CREW_LINK_LINE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? FLY_HOURS {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? CAR_TIME {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public DateTime? TIME_TO_PORT {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public DateTime? TD {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public DateTime? TA {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public DateTime? ATD {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public DateTime? ATA {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public DateTime? TIME_FROM_PORT {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string DEPARTURE_AIRPORT {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string ARRIVAL_AIRPORT {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string FILIALE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string REASON {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string P_CODE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string MODIFY_REASON {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string DDO_CODE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string RANK_NO {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string MODULE_FLAG {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string SCHEDULE_TYPE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string VALID_FLAG {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string REMARKS {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string OPERNAME {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public DateTime? OPERTIME {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string WORK_NO {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public decimal? CREW_PAIRING_LINE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string D_OR_I {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string HOME_BASE {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string PREPARE_NET {get;set;}
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
public string FLG_CS {get;set;}
}
}

View File

@ -0,0 +1,40 @@
using ICrewApi.Entity;
using ICrewApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class UCustom023
{
public static List<DSPersonScheduleModel> Init()
{
PersonScheduleParam personScheduleParam = new PersonScheduleParam()
{
ENDDATE=DateTime.Now,
STARTDATE=DateTime.Now,
} ;
List<DSPersonScheduleModel> result = new List<DSPersonScheduleModel>();
try
{
var result1 =NewUnitTest.Db.Queryable<V_PERSON_SCHEDULE_A>()
.LeftJoin<T_BAS_AIRPORT>((ps, sa) => ps.DEPARTURE_AIRPORT == sa.AIRPORT_3CODE)
.LeftJoin<T_BAS_AIRPORT>((ps, sa, sb) => ps.ARRIVAL_AIRPORT == sb.AIRPORT_3CODE)
.Where(ps => personScheduleParam.P_CODE.Contains(ps.P_CODE) && ps.FROM_DATE <= personScheduleParam.ENDDATE && ps.TO_DATE >= personScheduleParam.STARTDATE)
.ToSql();
if (result1.Value.First().DbType != System.Data.DbType.Date)
{
throw new Exception("unit error");
}
}
catch (Exception ex)
{
}
return result;
}
}
}