public void FeeSchedTools_CopyFeeSched_Clinics() { //Make sure there are no duplicate fees already present within the database. string dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check); if (dbmResult.Trim() != _feeDeleteDuplicatesExpectedResult) { DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Fix); } //Make sure that there are more than six clinics ClinicT.ClearClinicTable(); for (int i = 0; i < 10; i++) { ClinicT.CreateClinic(MethodBase.GetCurrentMethod().Name + "_" + i); } //Create two fee schedules; from and to FeeSched feeSchedNumFrom = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM"); FeeSched feeSchedNumTo = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO"); //Create a fee for every single procedure code in the database and associate it to the "from" fee schedule. foreach (ProcedureCode code in _listProcCodes) { FeeT.CreateFee(feeSchedNumFrom.FeeSchedNum, code.CodeNum, _rand.Next(5000)); } //Copy the "from" fee schedule into the "to" fee schedule and do it for at least seven clinics. FeeScheds.CopyFeeSchedule(feeSchedNumFrom, 0, 0, feeSchedNumTo, Clinics.GetDeepCopy(true).Select(x => x.ClinicNum).ToList(), 0); //Make sure that there was NOT a duplicate fee inserted into the database. dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check); Assert.AreEqual(dbmResult.Trim(), _feeDeleteDuplicatesExpectedResult, "Duplicate fees detected due to concurrent copying."); }
public void FeeSchedTools_CopyFeeSched_Concurrency() { //Make sure there are no duplicate fees already present within the database. string dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check); if (dbmResult.Trim() != _feeDeleteDuplicatesExpectedResult) { DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Fix); } //Create two fee schedules; from and to FeeSched feeSchedFrom = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM"); FeeSched feeSchedTo = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO"); //Create a single fee and associate it to the "from" fee schedule. FeeT.CreateFee(feeSchedFrom.FeeSchedNum, _listProcCodes[_rand.Next(_listProcCodes.Count - 1)].CodeNum, _defaultFeeAmt); //Create a helper action that will simply copy the "from" schedule into the "to" schedule for the given fee cache passed in. Action actionCopyFromTo = new Action(() => { FeeScheds.CopyFeeSchedule(feeSchedFrom, 0, 0, feeSchedTo, null, 0); }); //Mimic each user clicking the "Copy" button from within the Fee Tools window one right after the other (before they click OK). actionCopyFromTo(); actionCopyFromTo(); //Make sure that there was NOT a duplicate fee inserted into the database. dbmResult = DatabaseMaintenances.FeeDeleteDuplicates(true, DbmMode.Check); Assert.AreEqual(dbmResult.Trim(), _feeDeleteDuplicatesExpectedResult, "Duplicate fees detected due to concurrent copying."); }
public void FeeSchedTools_ImportCanada() { string canadianCodes = Properties.Resources.canadianprocedurecodes; //If we need to import these procedures codes, do so foreach (string line in canadianCodes.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)) { string[] properties = line.Split('\t'); if (properties.Count() != 10) { continue; } if (ProcedureCodes.GetCodeNum(properties[0]) != 0) { continue; } ProcedureCode procCode = new ProcedureCode() { ProcCode = properties[0], Descript = properties[1], ProcTime = properties[8], AbbrDesc = properties[9], }; ProcedureCodes.Insert(procCode); } //Now import the fees string feeData = Properties.Resources.BC_BCDA_2018_GPOOC; FeeSched feeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name, isGlobal: false); List <Fee> listNewFees = FeeScheds.ImportCanadaFeeSchedule2(feeSched, feeData, 0, 0, out int numImported, out int numSkipped); Assert.IsTrue(DoAmountsMatch(listNewFees, feeSched.FeeSchedNum, 0, 0)); }
public void FeeSchedTools_CopyFeeSched() { //Create two fee schedules; from and to FeeSched fromFeeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_FROM"); FeeSched toFeeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, MethodBase.GetCurrentMethod().Name + "_TO"); //Create a single fee and associate it to the "from" fee schedule. long feeCodeNum = _listProcCodes[_rand.Next(_listProcCodes.Count - 1)].CodeNum; FeeT.CreateFee(fromFeeSched.FeeSchedNum, feeCodeNum, _defaultFeeAmt * _rand.NextDouble()); FeeScheds.CopyFeeSchedule(fromFeeSched, 0, 0, toFeeSched, null, 0); //Get the two fees and check that they are the same. Fee fromFee = Fees.GetFee(feeCodeNum, fromFeeSched.FeeSchedNum, 0, 0); Fee toFee = Fees.GetFee(feeCodeNum, toFeeSched.FeeSchedNum, 0, 0); Assert.AreEqual(fromFee.Amount, toFee.Amount); }
public void Fees_GetByFeeSchedNumsClinicNums_MiddleTier() { List <long> listFeeSchedNums = new List <long>(); long codeNum1 = ProcedureCodes.GetCodeNum("D1110"); long codeNum2 = ProcedureCodes.GetCodeNum("D1206"); for (int i = 0; i < 300; i++) { FeeSched feeSched = FeeSchedT.GetNewFeeSched(FeeScheduleType.Normal, "FS" + i); FeeT.GetNewFee(feeSched.FeeSchedNum, codeNum1, 11); FeeT.GetNewFee(feeSched.FeeSchedNum, codeNum2, 13); listFeeSchedNums.Add(feeSched.FeeSchedNum); } DataAction.RunMiddleTierMock(() => { List <FeeLim> listFees = Fees.GetByFeeSchedNumsClinicNums(listFeeSchedNums, new List <long> { 0 }); Assert.AreEqual(600, listFees.Count); }); }