public void ValidName_ReturnsTrueForValidNames() { Assert.True(DoctorValidator.ValidName("John Smith")); Assert.True(DoctorValidator.ValidName("Rose Tyler")); Assert.True(DoctorValidator.ValidName("Christopher Eccleston")); Assert.False(DoctorValidator.ValidName("Doctor")); }
public void ValidYear_ReturnsTrueForValidYears() { Assert.True(DoctorValidator.ValidYear(1963)); Assert.True(DoctorValidator.ValidYear(1970)); Assert.True(DoctorValidator.ValidYear(1995)); Assert.True(DoctorValidator.ValidYear(2003)); Assert.True(DoctorValidator.ValidYear(2011)); Assert.True(DoctorValidator.ValidYear(2049)); }
/// <summary> /// Gets the doctors who portrayed the doctor in a given year. /// </summary> /// <param name="year">The year to lookup doctors by.</param> /// <returns>The doctors who portrayed the doctor in a given year.</returns> public IEnumerable <Doctor> GetDoctorsForYear(int year) { if (!DoctorValidator.ValidYear(year)) { return(new List <Doctor>()); } return(_theDoctors.Where(doc => doc.Years.Contains(year))); }
public EditDoctorViewModel(DoctorModel doctor) { // Property Doctor = doctor; ValidationRules = new DoctorValidator(); // Command PutCommand = new Command(Put); }
// ctor public AddDoctorViewModel() { // Property Doctor = new DoctorModel(); ValidationRules = new DoctorValidator(); // Command PostCommand = new Command(Post); }
/// <summary> /// Finds information about a given Doctor by actor name. /// </summary> /// <param name="name">The actor's name to look up.</param> /// <returns>Information about the doctor as portrayed by the given actor.</returns> public Doctor GetDoctorByName(string name) { // TODO: Add partial name matching. if (!DoctorValidator.ValidName(name)) { return(null); } return(_theDoctors.Find(doc => doc.ActorName.Equals(name, StringComparison.CurrentCultureIgnoreCase))); }
public JsonResult Delete(int id) { var request = new DoctorRequest { Data = new DoctorModel { Id = id, Account = Account }, Action = ClinicEnums.Action.DELETE.ToString() }; DoctorResponse _response = new DoctorValidator(_unitOfWork).Validate(request); return(Json(new { Status = _response.Status, Message = _response.Message }, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(DoctorModel model) { model.Account = Account; var request = new DoctorRequest { Data = model }; DoctorResponse _response = new DoctorValidator(_unitOfWork).Validate(request); ViewBag.Response = $"{_response.Status};{_response.Message}"; ViewBag.DoctorTypes = BindDropDownDoctorType(); return(View()); }
public ActionResult Create(DoctorModel model) { model.Account = Account; // set as paramedic model.TypeID = 1; var request = new DoctorRequest { Data = model }; DoctorResponse _response = new DoctorValidator(_unitOfWork, _context).Validate(request); ViewBag.Response = $"{_response.Status};{_response.Message}"; ViewBag.DoctorTypes = BindDropDownDoctorType(); ViewBag.OrganizationList = BindDropDownOrganization(); return(View()); }
public void ValidYear_ReturnsFalseForYearsSignificantlyAfterCurrentYear() { Assert.False(DoctorValidator.ValidYear(2050)); }
public void ValidYear_ReturnsFalseForYearsBeforeShowStart() { Assert.False(DoctorValidator.ValidYear(1962)); }
public void ValidName_ReturnsFalseForMoreThanTwoNames() { Assert.False(DoctorValidator.ValidName("Frank Smith Halloway")); Assert.False(DoctorValidator.ValidName("John Jacob Jingleheimer Smith")); }
public void ValidName_ReturnsFalseForSingleNames() { Assert.False(DoctorValidator.ValidName("Frank")); }
public void ValidName_ReturnsFalseFromInvalidCharacters() { Assert.False(DoctorValidator.ValidName("Doc.tor W&*ho")); }
public void ValidName_ReturnsFalseFromEmptyString() { Assert.False(DoctorValidator.ValidName(string.Empty)); }
public void ValidName_ReturnsFalseFromNullInput() { Assert.False(DoctorValidator.ValidName(null)); }