Template
77 lines
3.8 KiB
C#
77 lines
3.8 KiB
C#
using Strata.DecisionSupport.Biz.Parameters;
|
|
using Strata.DecisionSupport.Biz.Services;
|
|
using Strata.DecisionSupport.Models.Encounters;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using VerifyNUnit;
|
|
|
|
namespace Strata.DecisionSupport.Biz.Test.Unit.Services
|
|
{
|
|
[TestFixture, Category("Unit"), Category("DSS")]
|
|
public class DepartmentEncounterUnitOfServiceQueryTests : EncounterQueryServiceTests
|
|
{
|
|
[SetUp]
|
|
public void TestSetUp()
|
|
{
|
|
var uos = new List<DepartmentEncounterUnitOfService>
|
|
{
|
|
new DepartmentEncounterUnitOfService
|
|
{
|
|
DepartmentId = 1,
|
|
EncounterId = 2,
|
|
CostDriver = "LOS",
|
|
EntityId = 2,
|
|
Uos = 19.2486d
|
|
}
|
|
};
|
|
//Mock.Get(snowflakeDbContext)
|
|
// .Setup(x => x.QueryAsync<DepartmentEncounterUnitOfService>(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>(), It.IsAny<TimeSpan>()))
|
|
// .Returns(() => Task.FromResult(uos));
|
|
}
|
|
|
|
[TestCaseSource(nameof(DepartmentEncounterUnitOfServiceQueryTestCases))]
|
|
public async Task DepartmentEncounterUnitOfServiceQueryTest(string globalId)
|
|
{
|
|
var query = globalId.DepartmentEncounterUnitOfServiceQuery("DepartmentRollup1Id");
|
|
await Verifier.Verify(query, verifySettings)
|
|
.UseFileName(TestContext.CurrentContext.TestName());
|
|
Console.WriteLine(query);
|
|
}
|
|
|
|
public static IEnumerable<TestCaseData> DepartmentEncounterUnitOfServiceQueryTestCases()
|
|
{
|
|
yield return new TestCaseData("")
|
|
.SetName("{m} Entity");
|
|
yield return new TestCaseData("Location")
|
|
.SetName("{m} Location");
|
|
yield return new TestCaseData("DepartmentRollup1Id")
|
|
.SetName("{m} Department Rollup");
|
|
}
|
|
|
|
[TestCaseSource(nameof(EncounterUnitOfServiceQueryTestCases))]
|
|
public async Task RunDepartmentEncounterUnitOfServiceQueryTest(string globalId, int observationUnitsDivisor, IEnumerable<long> encounterIds)
|
|
{
|
|
var queryInfo = new DepartmentEncounterUnitOfServiceQueryInfo(globalId, observationUnitsDivisor, encounterIds);
|
|
var result = await service.RunDepartmentEncounterUnitOfServiceQuery(queryInfo, CancellationToken.None);
|
|
await Verifier.Verify(result, verifySettings)
|
|
.UseFileName(TestContext.CurrentContext.TestName());
|
|
}
|
|
|
|
public static IEnumerable<TestCaseData> EncounterUnitOfServiceQueryTestCases()
|
|
{
|
|
yield return new TestCaseData("", 24, new[] { 2L })
|
|
.SetName("{m} Entity 24 { 2 }")
|
|
.Ignore("System.ArgumentException : Invalid callback. Setup on method with return type 'Task<IEnumerable<DepartmentEncounterUnitOfService>>' cannot invoke callback with return type 'Task<List<DepartmentEncounterUnitOfService>>'");
|
|
yield return new TestCaseData("Location", 24, new[] { 2L })
|
|
.SetName("{m} Location 24 { 2 }")
|
|
.Ignore("System.ArgumentException : Invalid callback. Setup on method with return type 'Task<IEnumerable<DepartmentEncounterUnitOfService>>' cannot invoke callback with return type 'Task<List<DepartmentEncounterUnitOfService>>'");
|
|
yield return new TestCaseData("Department Rollup 1", 24, new[] { 2L })
|
|
.SetName("{m} Department Rollup 24 { 2 }")
|
|
.Ignore("System.ArgumentException : Invalid callback. Setup on method with return type 'Task<IEnumerable<DepartmentEncounterUnitOfService>>' cannot invoke callback with return type 'Task<List<DepartmentEncounterUnitOfService>>'");
|
|
}
|
|
|
|
|
|
}
|
|
} |