protected static void FeeTestSetup() { //Some unit tests cannot handle duplicate procedure codes being present within the database. //This is acceptable because that scenario should be impossible (we block the user via the UI layer). //Delete all duplicate procedure codes. Dictionary <string, ProcedureCode> dictProcCodes = ProcedureCodes.GetAllCodes().GroupBy(x => x.ProcCode).ToDictionary(x => x.Key, x => x.First()); ProcedureCodeT.ClearProcedureCodeTable(); foreach (ProcedureCode procedureCode in dictProcCodes.Values) { ProcedureCodes.Insert(procedureCode); } ProcedureCodes.RefreshCache(); _listProcCodes = ProcedureCodes.GetAllCodes(); //Just in case the PKs matter to some tests. _listProcCodesOld = _listProcCodes.Select(x => x.Copy()).ToList(); if (Fees.GetCountByFeeSchedNum(_standardFeeSchedNum) <= 0) { List <Fee> listFees = new List <Fee>(); foreach (ProcedureCode procCode in _listProcCodes) { listFees.Add(new Fee() { FeeSched = _standardFeeSchedNum, CodeNum = procCode.CodeNum, Amount = _defaultFeeAmt * _rand.NextDouble(), ClinicNum = 0, ProvNum = 0 }); //create the default fee schedule fee } Fees.InsertMany(listFees); } }
public void FeeSchedTools_ClearFeeSchedule() { FeeTestArgs feeArgs = CreateManyFees(1, 1, 1, MethodBase.GetCurrentMethod().Name); long feeSchedNum = feeArgs.ListFeeSchedNums[0]; Assert.IsTrue(Fees.GetCountByFeeSchedNum(feeSchedNum) > 0); Fees.DeleteFees(feeSchedNum, feeArgs.ListClinics[0].ClinicNum, feeArgs.ListProvNums[0]); Assert.AreEqual(0, Fees.GetCountByFeeSchedNum(feeSchedNum)); }