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")); }
/// <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 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)); }