增加测试内容。

This commit is contained in:
falcon 2021-12-15 10:41:19 +08:00
parent 89f3a406c2
commit 2bcbeb4dae
2 changed files with 140 additions and 1 deletions

View File

@ -17,4 +17,83 @@ namespace Falcon.StoredProcedureRunnerTests
public string empname { get; set; }
public string empactive { get; set; }
}
/// <summary>
/// 体检接口 挂号查询
/// </summary>
public class Tjjk_Tjgh
{
/// <summary>
/// 身份证号码
/// </summary>
public string v_sfz { get; set; }
/// <summary>
/// 医疗机构代码
/// </summary>
public string v_yljgdm { get; set; }
/// <summary>
/// 挂号日期 格式yyyyMMdd
/// </summary>
public string v_ghrq { get; set; }
[FalconSPPrarmDirection(ParameterDirection.Output)]
[FalconSPPrarmType(FalconSPDbType.OracleRefCursor)]
public object v_data { get; set; }
}
/// <summary>
/// 挂号查询结果
/// </summary>
public class Tjjk_TjghResult
{
/// <summary>
/// 卡号
/// </summary>
public string kh { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string xm { get; set; }
/// <summary>
/// 身份证号码
/// </summary>
public string sfzh { get; set; }
/// <summary>
/// 科室编号
/// </summary>
public string ksbh { get; set; }
/// <summary>
/// 科室名称
/// </summary>
public string ksmc { get; set; }
/// <summary>
/// 区县标志 本区 外区
/// </summary>
public string qxbz { get; set; }
/// <summary>
/// 挂号编号
/// </summary>
public string ghbh { get; set; }
/// <summary>
/// 挂号状态.已挂号 未挂号 已退费
/// </summary>
public string state { get; set; }
}
internal class GetDoctorData
{
public string v_orgaid { get; set; }
[FalconSPPrarmDirection(ParameterDirection.Output)]
[FalconSPPrarmType(FalconSPDbType.OracleRefCursor)]
public object v_data { get; set; }
}
internal class GetDoctorDataResult
{
public string Name_ { get; set; }
public string Dept_Name { get; set; }
public string Consulting_Room { get; set; }
}
}

View File

@ -9,7 +9,7 @@ namespace Falcon.StoredProcedureRunner.Tests
[TestClass()]
public class RunnerTests
{
[TestMethod()]
[TestMethod("通用测试")]
public void RunTest()
{
OracleTest();
@ -17,6 +17,7 @@ namespace Falcon.StoredProcedureRunner.Tests
SqlserverTest();
}
[TestMethod()]
public void SqlserverTest()
{
System.Console.WriteLine("SqlserverTest start!");
@ -43,6 +44,7 @@ namespace Falcon.StoredProcedureRunner.Tests
System.Console.WriteLine("SqlserverTest over!");
}
[TestMethod()]
public void OracleTest()
{
System.Console.WriteLine("OracleTest start!");
@ -67,5 +69,63 @@ namespace Falcon.StoredProcedureRunner.Tests
System.Console.WriteLine($"result count {result.Count}");
System.Console.WriteLine("OracleTest over!");
}
/// <summary>
/// 体检接口 挂号查询测试
/// </summary>
[TestMethod()]
public void Tjjk_TjghTest()
{
System.Console.WriteLine("OracleTest start!");
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddJsonFile("AppSettings.json");
configurationBuilder.AddUserSecrets(this.GetType().Assembly);
var config = configurationBuilder.Build();
var ora = config.GetSection("db:oracle").Value;
var oraVer = config.GetSection("db:ver").Value;
var buider = new DbContextOptionsBuilder();
var db = new DbContext(buider.UseOracle(ora, o => o.UseOracleSQLCompatibility(oraVer)).Options);
IRunner runner = new Runner();
var result = runner.Run<Tjjk_Tjgh, Tjjk_TjghResult>(db, new Tjjk_Tjgh
{
v_ghrq = "20211105",
v_sfz = "610528199002165174",
v_yljgdm = "50e3d44d-9ca2-4fbd-9d5d-d32339b1b113",
}).ToList();
Assert.IsNotNull(result);
System.Console.WriteLine("result ok");
CollectionAssert.AllItemsAreNotNull(result);
Assert.IsTrue(result.Count > 0);
System.Console.WriteLine($"result count {result.Count}");
System.Console.WriteLine("OracleTest over!");
}
[TestMethod()]
public void GetDoctorDataTest()
{
System.Console.WriteLine("OracleTest start!");
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddJsonFile("AppSettings.json");
configurationBuilder.AddUserSecrets(this.GetType().Assembly);
var config = configurationBuilder.Build();
var ora = config.GetSection("db:oracle").Value;
var oraVer = config.GetSection("db:ver").Value;
var buider = new DbContextOptionsBuilder();
var db = new DbContext(buider.UseOracle(ora, o => o.UseOracleSQLCompatibility(oraVer)).Options);
IRunner runner = new Runner();
var result = runner.Run<GetDoctorData, GetDoctorDataResult>(db, new GetDoctorData
{
v_orgaid = "50e3d44d-9ca2-4fbd-9d5d-d32339b1b113",
}).ToList();
Assert.IsNotNull(result);
System.Console.WriteLine("result ok");
CollectionAssert.AllItemsAreNotNull(result);
Assert.IsTrue(result.Count > 0);
System.Console.WriteLine($"result count {result.Count}");
System.Console.WriteLine("OracleTest over!");
}
}
}