public void Parse_ValidPersonnummer_ReturnsAllValidParts() { var pn = SwedishPersonNumber.Parse("811218-9876"); Assert.AreEqual(Gender.Male, pn.Gender); Assert.AreEqual(new DateTime(1981, 12, 18), pn.DateOfBirth); Assert.AreEqual("987", pn.Löpnummer); Assert.AreEqual(6, pn.CheckDigit); Assert.IsTrue(pn.IsChecksumValid()); }
public void ToString_ValidPersonnummer_FormatsCorrectly() { var pn1 = SwedishPersonNumber.Parse("811218-9876"); Assert.AreEqual("19811218-9876", pn1.ToString()); Assert.AreEqual("811218-9876", pn1.ToShortString()); var pn2 = SwedishPersonNumber.Parse("18811218-9876"); Assert.AreEqual("18811218+9876", pn2.ToString()); Assert.AreEqual("811218+9876", pn2.ToShortString()); }