public void FeeSchedTools_GlobalUpdateFees() { PrefT.UpdateBool(PrefName.MedicalFeeUsedForNewProcs, false); string suffix = MethodBase.GetCurrentMethod().Name; string procStr = "D0120"; string procStr2 = "D0145"; double procFee = 100; ProcedureCode procCode = ProcedureCodes.GetProcCode(procStr); ProcedureCode procCode2 = ProcedureCodes.GetProcCode(procStr2); //Set up clinic, prov, pat Clinic clinic = ClinicT.CreateClinic(suffix); long feeSchedNum = FeeSchedT.CreateFeeSched(FeeScheduleType.Normal, suffix, false); long provNum = ProviderT.CreateProvider(suffix, feeSchedNum: feeSchedNum); Fee fee = FeeT.GetNewFee(feeSchedNum, procCode.CodeNum, procFee, clinic.ClinicNum, provNum); Fee fee2 = FeeT.GetNewFee(feeSchedNum, procCode2.CodeNum, procFee, clinic.ClinicNum, provNum); Patient pat = PatientT.CreatePatient(suffix, provNum, clinic.ClinicNum); //Chart a procedure for this proccode/pat as well as a different proccode Procedure proc = ProcedureT.CreateProcedure(pat, procStr, ProcStat.TP, "", fee.Amount); Procedure proc2 = ProcedureT.CreateProcedure(pat, procStr2, ProcStat.TP, "", fee2.Amount); //Update the fee amount for only the D0120 code fee.Amount = 50; Fees.Update(fee); //Now run global update fees Procedures.GlobalUpdateFees(Fees.GetByClinicNum(clinic.ClinicNum), clinic.ClinicNum, clinic.Abbr); //Make sure we have the same number of updated fees, and fee amounts for both procs proc = Procedures.GetOneProc(proc.ProcNum, false); proc2 = Procedures.GetOneProc(proc2.ProcNum, false); Assert.AreEqual(fee.Amount, proc.ProcFee); Assert.AreEqual(fee2.Amount, proc2.ProcFee); }
public void SecurityLogs_MakeLogEntry_DuplicateEntryParallelRandomKeys() { Patient patient = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); //First, turn on random primary keys PrefT.UpdateBool(PrefName.RandomPrimaryKeys, true); //There are lots of bug submissions with exception text like "Duplicate entry 'XXXXX' for key 'PRIMARY'". //OpenDentBusiness.SecurityLogs.MakeLogEntry() seems to be the common theme for most of the submissions. //Spawn parallel threads to insert 200 security logs trying to get a duplicate entry exception. List <Action> listActions = new List <Action>(); for (int i = 0; i < 200; i++) { listActions.Add(() => SecurityLogs.MakeLogEntry(Permissions.Accounting, patient.PatNum, "", 0, DateTime.Now.AddDays(-7))); } //Parallel threads do not support Middle Tier mode when unit testing due to how we have to fake being both the client and the server. RemotingRole remotingRoleOld = RemotingClient.RemotingRole; if (RemotingClient.RemotingRole != RemotingRole.ClientDirect) { RemotingClient.RemotingRole = RemotingRole.ClientDirect; } ODThread.RunParallel(listActions, onException: (ex) => { PrefT.UpdateBool(PrefName.RandomPrimaryKeys, false); RemotingClient.RemotingRole = remotingRoleOld; Assert.Fail(ex.Message); }); PrefT.UpdateBool(PrefName.RandomPrimaryKeys, false); RemotingClient.RemotingRole = remotingRoleOld; }
///<summary>Creates patients with billing cycle day. Sets BillingUseBillingCycleDay preference to true. Creates an UpdateHistory ///entry for version 16.1.1.0. Deletes all current repeat charges.</summary> public Patient CreatePatForRepeatCharge(string suffix, int billingCycleDay) { Patient pat = PatientT.CreatePatient(suffix); Patient patOld = pat.Copy(); pat.BillingCycleDay = billingCycleDay; Patients.Update(pat, patOld); PrefT.UpdateBool(PrefName.BillingUseBillingCycleDay, true); UpdateHistoryT.CreateUpdateHistory("16.1.1.0"); Prefs.RefreshCache(); List <RepeatCharge> listRepeatingCharges = RepeatCharges.Refresh(0).ToList(); listRepeatingCharges.ForEach(x => RepeatCharges.Delete(x)); return(pat); }
public void SetupTest() { PrefT.UpdateBool(PrefName.EasyNoClinics, false); PrefT.UpdateInt(PrefName.TasksGlobalFilterType, (int)GlobalTaskFilterType.None); TaskListT.ClearTaskListTable(); TaskT.ClearTaskTable(); TaskSubscriptionT.ClearTaskSubscriptionTable(); _taskListMainNoFilter = TaskListT.CreateTaskList(descript: "No Filter", parent: 0, globalTaskFilterType: GlobalTaskFilterType.None); _taskListClinic = TaskListT.CreateTaskList(descript: "Clinic Filter", parent: _taskListMainNoFilter.TaskListNum, globalTaskFilterType: GlobalTaskFilterType.Clinic); _taskListRegion = TaskListT.CreateTaskList(descript: "Region Filter", parent: _taskListMainNoFilter.TaskListNum, globalTaskFilterType: GlobalTaskFilterType.Region); _taskListRepeating = TaskListT.CreateTaskList("Repeating", isRepeating: true); TaskSubscriptions.TrySubscList(_taskListMainNoFilter.TaskListNum, _userA.UserNum); TaskSubscriptions.TrySubscList(_taskListClinic.TaskListNum, _userA.UserNum); TaskSubscriptions.TrySubscList(_taskListRegion.TaskListNum, _userA.UserNum); TaskSubscriptions.TrySubscList(_taskListRegion.TaskListNum, _userNW.UserNum); }
public void EmailMessages_FindAndReplacePostalAddressTag() { //Format disclaimer. PrefT.UpdateString(PrefName.EmailDisclaimerTemplate, "This email has been sent to you from:\r\n[PostalAddress].\r\n\r\nHow to unsubscribe:\r\nIf you no longer want to receive any email messages from us, simply reply to this email with the word \"unsubscribe\" in the subject line."); //Setup practice address. PrefT.UpdateString(PrefName.PracticeAddress, "Practice Address1 Here"); PrefT.UpdateString(PrefName.PracticeAddress2, "3275 Marietta St SE"); PrefT.UpdateString(PrefName.PracticeCity, "Salem"); PrefT.UpdateString(PrefName.PracticeST, "OR"); PrefT.UpdateString(PrefName.PracticeZip, "97317"); //Setup clinic address. Clinic clinic = ClinicT.CreateClinic(); clinic.Address = "Clinic Address1 Here"; Clinics.Update(clinic); Clinics.RefreshCache(); //Turn feature off. PrefT.UpdateBool(PrefName.EmailDisclaimerIsOn, false); string emailBody = "Hi, this is an email.\r\n\r\nRegards,\r\nEvery OD Engineer... ever."; string emailBodyWithDisclaimer = EmailMessages.FindAndReplacePostalAddressTag(emailBody, 0); //Feature is off so no disclaimer added. Assert.AreEqual(emailBody, emailBodyWithDisclaimer); //Turn feature on. PrefT.UpdateBool(PrefName.EmailDisclaimerIsOn, true); //Turn clinics off. PrefT.UpdateBool(PrefName.EasyNoClinics, true); emailBodyWithDisclaimer = EmailMessages.FindAndReplacePostalAddressTag(emailBody, 0); //Feature is on so disclaimer added (no clinic). Assert.AreNotEqual(emailBody, emailBodyWithDisclaimer); Assert.IsTrue(emailBodyWithDisclaimer.EndsWith("subject line.")); Assert.IsTrue(emailBodyWithDisclaimer.Contains("Practice Address")); Assert.IsFalse(emailBodyWithDisclaimer.Contains("Clinic Address")); //Turn clinics on. PrefT.UpdateBool(PrefName.EasyNoClinics, false); emailBodyWithDisclaimer = EmailMessages.FindAndReplacePostalAddressTag(emailBody, clinic.ClinicNum); //Feature is on so disclaimer added (with clinic). Assert.AreNotEqual(emailBody, emailBodyWithDisclaimer); Assert.IsTrue(emailBodyWithDisclaimer.EndsWith("subject line.")); Assert.IsTrue(emailBodyWithDisclaimer.Contains("Clinic Address")); Assert.IsFalse(emailBodyWithDisclaimer.Contains("Practice Address")); }
public void SecurityLogs_MakeLogEntry_DuplicateEntryRandomKeys() { Patient patient = PatientT.CreatePatient(MethodBase.GetCurrentMethod().Name); //First, turn on random primary keys PrefT.UpdateBool(PrefName.RandomPrimaryKeys, true); //There are lots of bug submissions with exception text like "Duplicate entry 'XXXXX' for key 'PRIMARY'". //OpenDentBusiness.SecurityLogs.MakeLogEntry() seems to be the common theme for most of the submissions. //Loop as fast as we can and insert 200 security logs trying to get a duplicate entry exception. for (int i = 0; i < 200; i++) { try { SecurityLogs.MakeLogEntry(Permissions.Accounting, patient.PatNum, "", 0, DateTime.Now.AddDays(-7)); } catch (Exception ex) { PrefT.UpdateBool(PrefName.RandomPrimaryKeys, false); Assert.Fail(ex.Message); break; } } PrefT.UpdateBool(PrefName.RandomPrimaryKeys, false); }
public void Legacy_TestFiftyFour() { //When there are multiple repeat charges on one account and the repeat charge tool is run, and then a procedure from the account is deleted, //and then the repeat charges tool is run again, the same number of procedures that were deleted should be added. string suffix = "54"; Patient pat = PatientT.CreatePatient(suffix); Patient patOld = pat.Copy(); pat.BillingCycleDay = 11; Patients.Update(pat, patOld); PrefT.UpdateBool(PrefName.BillingUseBillingCycleDay, true); PrefT.UpdateBool(PrefName.FutureTransDatesAllowed, true); UpdateHistoryT.CreateUpdateHistory("16.1.1.0"); //Sets a timestamp that determines which logic we use to calculate repeate charge procedures Prefs.RefreshCache(); List <RepeatCharge> listRepeatingCharges = RepeatCharges.Refresh(0).ToList(); listRepeatingCharges.ForEach(x => RepeatCharges.Delete(x)); DateTime dateRun = new DateTime(DateTime.Today.AddMonths(2).Year, DateTime.Today.AddMonths(2).Month, 15);//The 15th of two months from now List <int> listFailedTests = new List <int>(); RepeatCharge rc = new RepeatCharge(); rc.ChargeAmt = 99; rc.PatNum = pat.PatNum; rc.ProcCode = "D2750"; rc.IsEnabled = true; rc.DateStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 15); //The 15th of this month rc.Note = "Charge #1"; rc.CopyNoteToProc = true; rc.RepeatChargeNum = RepeatCharges.Insert(rc); rc = new RepeatCharge(); rc.ChargeAmt = 99; rc.PatNum = pat.PatNum; rc.ProcCode = "D2750"; rc.IsEnabled = true; rc.DateStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 15); rc.Note = "Charge #2"; rc.CopyNoteToProc = true; rc.RepeatChargeNum = RepeatCharges.Insert(rc); rc = new RepeatCharge(); rc.ChargeAmt = 99; rc.PatNum = pat.PatNum; rc.ProcCode = "D2750"; rc.IsEnabled = true; rc.DateStart = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 15); rc.Note = "Charge #3"; rc.CopyNoteToProc = true; rc.RepeatChargeNum = RepeatCharges.Insert(rc); //Subtest 1 =============================================================== //There are three procedures with the same amount, proc code, and start date. Run the repeat charge tool. Delete all procedures from //last month. Run the repeat charge tool again. Make sure that the correct repeat charges were added back. RepeatCharges.RunRepeatingCharges(dateRun); List <Procedure> procs = Procedures.Refresh(pat.PatNum); int lastMonth = dateRun.AddMonths(-1).Month; int thisMonth = dateRun.Month; //Delete all procedures from last month procs.FindAll(x => x.ProcDate.Month == lastMonth) .ForEach(x => Procedures.Delete(x.ProcNum)); RepeatCharges.RunRepeatingCharges(dateRun); procs = Procedures.Refresh(pat.PatNum); //Make sure that the correct number of procedures were added using the correct repeating charges if (procs.Count != 6 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #3").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #3").Count != 1) { listFailedTests.Add(1); } //Subtest 2 =============================================================== //Run the repeat charge tool. Delete all procedures from this month. Run the repeat charge tool again. Make sure that the correct //repeat charges were added back. procs.ForEach(x => Procedures.Delete(x.ProcNum)); RepeatCharges.RunRepeatingCharges(dateRun); procs = Procedures.Refresh(pat.PatNum); //Delete all procedures from this month procs.FindAll(x => x.ProcDate.Month == thisMonth) .ForEach(x => Procedures.Delete(x.ProcNum)); RepeatCharges.RunRepeatingCharges(dateRun); procs = Procedures.Refresh(pat.PatNum); //Make sure that the correct number of procedures were added using the correct repeating charges if (procs.Count != 6 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #3").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #3").Count != 1) { listFailedTests.Add(2); } //Subtest 3 =============================================================== //Run the repeat charge tool. Delete one procedure from this month. Run the repeat charge tool again. Make sure that the correct //repeat charges were added back. procs.ForEach(x => Procedures.Delete(x.ProcNum)); RepeatCharges.RunRepeatingCharges(dateRun); procs = Procedures.Refresh(pat.PatNum); //Delete one procedure from this month procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #1") .ForEach(x => Procedures.Delete(x.ProcNum)); RepeatCharges.RunRepeatingCharges(dateRun); procs = Procedures.Refresh(pat.PatNum); //Make sure that the correct number of procedures were added using the correct repeating charges if (procs.Count != 6 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #3").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #3").Count != 1) { listFailedTests.Add(3); } //Subtest 4 =============================================================== //Run the repeat charge tool. Delete one procedure from last month. Run the repeat charge tool again. Make sure that the correct //repeat charges were added back. procs.ForEach(x => Procedures.Delete(x.ProcNum)); RepeatCharges.RunRepeatingCharges(dateRun); procs = Procedures.Refresh(pat.PatNum); //Delete one procedure from last month procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #1") .ForEach(x => Procedures.Delete(x.ProcNum)); RepeatCharges.RunRepeatingCharges(dateRun); procs = Procedures.Refresh(pat.PatNum); //Make sure that the correct number of procedures were added using the correct repeating charges if (procs.Count != 6 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == lastMonth && x.BillingNote == "Charge #3").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #1").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #2").Count != 1 || procs.FindAll(x => x.ProcDate.Month == thisMonth && x.BillingNote == "Charge #3").Count != 1) { listFailedTests.Add(4); } Assert.AreEqual(0, listFailedTests.Count); }
public static void SetupClass(TestContext testContext) { //Make sure the SpellCheck preference is enabled. PrefT.UpdateBool(PrefName.SpellCheckIsEnabled, true); }