public void setToManyNumbersInPesel() { System.Exception exeption; PeselValidator pesel = new PeselValidator(); pesel.PeselNumber = "123456789012"; }
public void propertyIsNotNull() { PeselValidator pesel = new PeselValidator(); pesel.PeselNumber = "92092609898"; Assert.IsNotNull(pesel.GetPesel()); }
public DateTime GetDateOfBirth(string pesel) { DateTime time; if (PeselValidator.CheckPesel(pesel) == true) { int year = Convert.ToInt32(pesel.Substring(0, 2)); int month = Convert.ToInt32(pesel.Substring(2, 2)); int day = Convert.ToInt32(pesel.Substring(4, 2)); int testyear = year; int testmonth = month % 20; int testday = day; if (month / 20 == 4) { testyear += 1800; } if (month / 20 == 0) { testyear += 1900; } if (month / 20 == 1) { testyear += 2000; } try { time = new DateTime(testyear, testmonth, testday); } catch (ArgumentOutOfRangeException arg) { throw new InvalidPeselExeptions("Wrong data in Pesel"); } return(time); } throw new InvalidPeselExeptions("Wrong data in Pesel"); }
public void setLessNumbersInPesel() { PeselValidator pesel = new PeselValidator(); pesel.PeselNumber = "1234567890"; }
public void isFieldNull() { PeselValidator pesel = new PeselValidator(); Assert.IsNull(pesel.PeselNumber); }
public void setCharInPeselExeption() { PeselValidator pesel = new PeselValidator(); pesel.PeselNumber = "1a345678901"; Assert.IsNull(pesel.PeselNumber); }
public void setFloatPeselExeption() { PeselValidator pesel = new PeselValidator(); pesel.PeselNumber = "123456789.1"; Assert.AreNotEqual("123456789.1", pesel.PeselNumber); }
public void setGoodPesel() { PeselValidator pesel = new PeselValidator(); pesel.PeselNumber = "92092609898"; Assert.AreEqual("92092609898", pesel.PeselNumber); }