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 { new DepartmentEncounterUnitOfService { DepartmentId = 1, EncounterId = 2, CostDriver = "LOS", EntityId = 2, Uos = 19.2486d } }; //Mock.Get(snowflakeDbContext) // .Setup(x => x.QueryAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) // .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 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 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 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>' cannot invoke callback with return type 'Task>'"); 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>' cannot invoke callback with return type 'Task>'"); 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>' cannot invoke callback with return type 'Task>'"); } } }