public void InsertTest() { TestUtils.Security.SetCurrentUser(TestEnums.User.constDoctorID); // happy scenario insert without any problem var doctorSchedule = DoctorScheduleServiceTest.CreateNewDoctorSchedule(); DoctorScheduleBR doctorScheduleBR = (DoctorScheduleBR)EntityFactory.GetEntityBusinessRuleByName(vDoctorSchedule.EntityName, ""); BusinessRuleErrorList errorsList = new BusinessRuleErrorList(); doctorScheduleBR.CheckRules(doctorSchedule, RuleFunctionSEnum.Insert, errorsList); Assert.AreEqual(0, errorsList.Count); }
public void InsertDuplicateTest() { string existingDateTimeInDatabase = "2020-06-25 12:15:00.000"; var doctorSchedule = DoctorScheduleServiceTest.CreateNewDoctorSchedule(); doctorSchedule.SlotUnixEpoch = DateTimeEpoch.ConvertDateToSecondsEpoch(DateTime.Parse(existingDateTimeInDatabase)); DoctorScheduleBR doctorScheduleBR = (DoctorScheduleBR)EntityFactory.GetEntityBusinessRuleByName(vDoctorSchedule.EntityName, ""); BusinessRuleErrorList errorsList = new BusinessRuleErrorList(); doctorScheduleBR.CheckRules(doctorSchedule, RuleFunctionSEnum.Insert, errorsList); if (errorsList.Count > 0) { Assert.AreEqual(BusinessErrorStrings.DoctorSchedule.TimeAllocatedBefore, errorsList[0].ErrorDescription); } Assert.AreEqual(1, errorsList.Count); }