public void JFK() { var jfk = new HumanName("president john 'jack' fitzgerald kennedy"); Assert.AreEqual("president", jfk.Title); Assert.AreEqual("john", jfk.First); Assert.AreEqual("fitzgerald", jfk.Middle); Assert.AreEqual("kennedy", jfk.Last); Assert.AreEqual(string.Empty, jfk.Suffix); Assert.AreEqual("jack", jfk.Nickname); Assert.AreEqual("president john fitzgerald kennedy", jfk.FullName); Assert.AreEqual("kennedy", jfk.LastBase); Assert.AreEqual(string.Empty, jfk.LastPrefixes); jfk.Normalize(); Assert.AreEqual("President", jfk.Title); Assert.AreEqual("John", jfk.First); Assert.AreEqual("Fitzgerald", jfk.Middle); Assert.AreEqual("Kennedy", jfk.Last); Assert.AreEqual(string.Empty, jfk.Suffix); Assert.AreEqual("Jack", jfk.Nickname); Assert.AreEqual("President John Fitzgerald Kennedy", jfk.FullName); Assert.AreEqual("Kennedy", jfk.LastBase); Assert.AreEqual(string.Empty, jfk.LastPrefixes); }
public void Nixon() { var nixon = new HumanName("mr president richard (dick) nixon"); Assert.AreEqual("mr president", nixon.Title); Assert.AreEqual("richard", nixon.First); Assert.AreEqual(string.Empty, nixon.Middle); Assert.AreEqual("nixon", nixon.Last); Assert.AreEqual(string.Empty, nixon.Suffix); Assert.AreEqual("dick", nixon.Nickname); Assert.AreEqual("mr president richard nixon", nixon.FullName); Assert.AreEqual("nixon", nixon.LastBase); Assert.AreEqual(string.Empty, nixon.LastPrefixes); nixon.Normalize(); Assert.AreEqual("Mr President", nixon.Title); Assert.AreEqual("Richard", nixon.First); Assert.AreEqual(string.Empty, nixon.Middle); Assert.AreEqual("Nixon", nixon.Last); Assert.AreEqual(string.Empty, nixon.Suffix); Assert.AreEqual("Dick", nixon.Nickname); Assert.AreEqual("Mr President Richard Nixon", nixon.FullName); Assert.AreEqual("Nixon", nixon.LastBase); Assert.AreEqual(string.Empty, nixon.LastPrefixes); }
public void LastBaseAndPrefixes() { var parsed = new HumanName("John Smith"); Assert.AreEqual("Smith", parsed.Last); Assert.AreEqual(string.Empty, parsed.LastPrefixes); Assert.AreEqual("Smith", parsed.LastBase); parsed = new HumanName("johannes van der waals"); Assert.AreEqual("johannes", parsed.First); Assert.AreEqual("van der", parsed.LastPrefixes); // specifically, the prefixes to the last name Assert.AreEqual("waals", parsed.LastBase); // only the base component of the last name Assert.AreEqual("van der waals", parsed.Last); // the full last name, combined parsed.Normalize(); Assert.AreEqual("Johannes", parsed.First); Assert.AreEqual("van der", parsed.LastPrefixes); Assert.AreEqual("Waals", parsed.LastBase); Assert.AreEqual("van der Waals", parsed.Last); }