Template
104 lines
5.7 KiB
C#
104 lines
5.7 KiB
C#
using Moq;
|
|
using Strata.DecisionSupport.Biz.Encounters;
|
|
using Strata.DecisionSupport.Biz.Parameters;
|
|
using Strata.DecisionSupport.Biz.Services;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using VerifyNUnit;
|
|
|
|
namespace Strata.DecisionSupport.Biz.Test.Unit.Services
|
|
{
|
|
[TestFixture, Category("Unit"), Category("DSS")]
|
|
public class EncounterInfoQueryTests : EncounterQueryServiceTests
|
|
{
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
var encounterInfo = new List<SnowflakeEncounterInfo> {
|
|
new SnowflakeEncounterInfo
|
|
{
|
|
EncounterId = 123456789,
|
|
EncounterRecordNumber = "123456789"
|
|
}
|
|
}.AsEnumerable();
|
|
Mock.Get(snowflakeDbContext)
|
|
.Setup(x => x.QueryAsync<SnowflakeEncounterInfo>(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>(), It.IsAny<TimeSpan>()))
|
|
.Returns(() => Task.FromResult(encounterInfo));
|
|
}
|
|
|
|
[TestCaseSource(nameof(EncounterInfoQueryTestCases))]
|
|
public async Task EncounterInfoQueryTest(string globalId, params object[] args)
|
|
{
|
|
var query = globalId.EncounterInfoQuery(args);
|
|
await Verifier.Verify(query, verifySettings)
|
|
.UseFileName(TestContext.CurrentContext.TestName());
|
|
}
|
|
|
|
public static IEnumerable<TestCaseData> EncounterInfoQueryTestCases()
|
|
{
|
|
yield return new TestCaseData("", Array.Empty<object>())
|
|
.SetName("{m} with no args");
|
|
yield return new TestCaseData("Location", Array.Empty<object>())
|
|
.SetName("{m} Location with no args");
|
|
yield return new TestCaseData("DepartmentRollup1Id", Array.Empty<object>())
|
|
.SetName("{m} Department Rollup with no args");
|
|
yield return new TestCaseData("", new[] {
|
|
"PrimaryServiceLine",
|
|
"INNER JOIN serviceLineTableName sl on sl.serviceLineIdAttribute = OBJ.serviceLineIdAttribute",
|
|
"DepartmentRollup1Id",
|
|
"OBJ.MSDRGCaseTypeFamilyID AS CaseTypeFamilyId\r\n\t,msdrg.CCMCCCategory",
|
|
"INNER JOIN dss.dimMSDRG msdrg ON obj.ReportingDRGID = msdrg.MSDRGID \r\n AND ((msdrg.Type IN ('MED', 'SURG') AND ptr.Type = 'Inpatient')\r\n OR ptr.Type <> 'Inpatient')"})
|
|
.SetName("{m} Entity");
|
|
yield return new TestCaseData("Location", new[] {
|
|
"PrimaryServiceLine",
|
|
"INNER JOIN serviceLineTableName sl on sl.serviceLineIdAttribute = OBJ.serviceLineIdAttribute",
|
|
"DepartmentRollup1Id",
|
|
"OBJ.MSDRGCaseTypeFamilyID AS CaseTypeFamilyId\r\n\t,msdrg.CCMCCCategory",
|
|
"INNER JOIN dss.dimMSDRG msdrg ON obj.ReportingDRGID = msdrg.MSDRGID\r\n AND ((msdrg.Type IN ('MED', 'SURG') AND ptr.Type = 'Inpatient')\r\n OR ptr.Type <> 'Inpatient')"})
|
|
.SetName("{m} Location");
|
|
yield return new TestCaseData("DepartmentRollup1Id", new[] {
|
|
"PrimaryServiceLine",
|
|
"INNER JOIN serviceLineTableName sl on sl.serviceLineIdAttribute = OBJ.serviceLineIdAttribute",
|
|
"DepartmentRollup1Id",
|
|
"OBJ.MSDRGCaseTypeFamilyID AS CaseTypeFamilyId\r\n\t,msdrg.CCMCCCategory",
|
|
"INNER JOIN dss.dimMSDRG msdrg ON obj.ReportingDRGID = msdrg.MSDRGID\r\n AND ((msdrg.Type IN ('MED', 'SURG') AND ptr.Type = 'Inpatient')\r\n OR ptr.Type <> 'Inpatient')"})
|
|
.SetName("{m} Department Rollup");
|
|
|
|
}
|
|
[TestCaseSource(nameof(EncounterInfoQueryTestCases1))]
|
|
public async Task RunEncounterInfoQueryTest(Models.Queries.CaseTypeCategory caseTypeCategory, Guid serviceLineGuid)
|
|
{
|
|
var queryInfo = new EncounterQueryInfo(caseTypeCategory, 210,
|
|
new DateTime(2023, 1, 1), new DateTime(2024, 1, 1), "",
|
|
serviceLineGuid, 24, new[] { 2 });
|
|
var results = await service.RunEncounterInfoQuery(queryInfo, CancellationToken.None);
|
|
await Verifier.Verify(results, verifySettings)
|
|
.UseFileName(TestContext.CurrentContext.TestName());
|
|
}
|
|
|
|
public static IEnumerable<TestCaseData> EncounterInfoQueryTestCases1()
|
|
{
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.MSDRG, serviceLineDimensionGuid)
|
|
.SetName("RunEncounterInfoQuery Msdrg ServiceLine");
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.APRDRG, serviceLineDimensionGuid)
|
|
.SetName("RunEncounterInfoQuery Aprdrg ServiceLine");
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.CPTCode, serviceLineDimensionGuid)
|
|
.SetName("RunEncounterInfoQuery CptCode ServiceLine");
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.PatientPopulation, serviceLineDimensionGuid)
|
|
.SetName("RunEncounterInfoQuery PatientPop ServiceLine");
|
|
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.MSDRG, sg2DimensionGuid)
|
|
.SetName("RunEncounterInfoQuery Msdrg Sg2");
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.APRDRG, sg2DimensionGuid)
|
|
.SetName("RunEncounterInfoQuery Aprdrg Sg2");
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.CPTCode, sg2DimensionGuid)
|
|
.SetName("RunEncounterInfoQuery CptCode Sg2");
|
|
yield return new TestCaseData(Models.Queries.CaseTypeCategory.PatientPopulation, sg2DimensionGuid)
|
|
.SetName("RunEncounterInfoQuery PatientPop Sg2");
|
|
}
|
|
|
|
}
|
|
} |