Template
70 lines
3.1 KiB
C#
70 lines
3.1 KiB
C#
using FluentAssertions;
|
|
using Moq;
|
|
using Strata.DecisionSupport.Biz.Parameters;
|
|
using Strata.DecisionSupport.Biz.Services;
|
|
using Strata.DecisionSupport.Models.Encounters;
|
|
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 EncounterCostInfoQueryTests : EncounterQueryServiceTests
|
|
{
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
var encounterCost = new List<EncounterCostInfo>
|
|
{
|
|
new EncounterCostInfo
|
|
{
|
|
EncounterId = 123456789,
|
|
EntityId = 2,
|
|
ChargeCodeId = 210,
|
|
CostDriver = "LOS"
|
|
|
|
}
|
|
}.AsEnumerable();
|
|
Mock.Get(snowflakeDbContext)
|
|
.Setup(x => x.QueryAsync<EncounterCostInfo>(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>(), It.IsAny<TimeSpan>()))
|
|
.Returns(() => Task.FromResult(encounterCost));
|
|
}
|
|
|
|
[TestCase("", true, TestName = "{m} Specific Entity")]
|
|
[TestCase("Location", true, TestName = "{m} Specific Location")]
|
|
[TestCase("DepartmentRollup1Id", true, TestName = "{m} Specific Department Rollup")]
|
|
[TestCase("", false, TestName = "{m} Static Entity")]
|
|
[TestCase("Location", false, TestName = "{m} Static Location")]
|
|
[TestCase("DepartmentRollup1Id", false, TestName = "{m} Static Department Rollup")]
|
|
public async Task EncounterCostInfoQueryTest(string globalId, bool isPatientSpecific)
|
|
{
|
|
var query = globalId.EncounterCostInfoQuery(isPatientSpecific, "DepartmentRollup1Id", "AND cc.CostDriver <> '' \r\n AND cc.CostDriver <> 'Excluded' ");
|
|
await Verifier.Verify(query, verifySettings)
|
|
.UseFileName(TestContext.CurrentContext.TestName());
|
|
}
|
|
|
|
[TestCaseSource(nameof(EncounterCostInfoQueryTestCases))]
|
|
public async Task RunEncounterCostInfoQueryTest(bool isPatientSpecific, string deptRollupId)
|
|
{
|
|
var queryInfo = new EncounterCostQueryInfo(isPatientSpecific, configurationGuid, string.Empty, deptRollupId, new[] { 2L });
|
|
var results = await service.RunEncounterCostInfoQuery(queryInfo, CancellationToken.None);
|
|
results.Should().NotBeNullOrEmpty()
|
|
.And.AllBeOfType<EncounterCostInfo>();
|
|
}
|
|
|
|
public static IEnumerable<TestCaseData> EncounterCostInfoQueryTestCases()
|
|
{
|
|
yield return new TestCaseData(true, "").SetName("{m} {p}");
|
|
yield return new TestCaseData(false, "").SetName("{m} {p}");
|
|
yield return new TestCaseData(true, "DepartmentRollup1ID").SetName("{m} {p}");
|
|
yield return new TestCaseData(false, "DepartmentRollup1ID").SetName("{m} {p}");
|
|
yield return new TestCaseData(true, "Location").SetName("{m} {p}");
|
|
yield return new TestCaseData(false, "Location").SetName("{m} {p}");
|
|
}
|
|
|
|
}
|
|
} |