예제 #1
0
        public void setToManyNumbersInPesel()
        {
            System.Exception exeption;
            PeselValidator pesel = new PeselValidator();

            pesel.PeselNumber = "123456789012";
        }
예제 #2
0
        public void propertyIsNotNull()
        {
            PeselValidator pesel = new PeselValidator();

            pesel.PeselNumber = "92092609898";

            Assert.IsNotNull(pesel.GetPesel());
        }
예제 #3
0
        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");
        }
예제 #4
0
 public void setLessNumbersInPesel()
 {
     PeselValidator pesel = new PeselValidator();
     pesel.PeselNumber = "1234567890";
 }
예제 #5
0
        public void isFieldNull()
        {
            PeselValidator pesel = new PeselValidator();

            Assert.IsNull(pesel.PeselNumber);
        }
예제 #6
0
 public void setCharInPeselExeption()
 {
     PeselValidator pesel = new PeselValidator();
     pesel.PeselNumber = "1a345678901";
     Assert.IsNull(pesel.PeselNumber);
 }
예제 #7
0
 public void setFloatPeselExeption()
 {
     PeselValidator pesel = new PeselValidator();
     pesel.PeselNumber = "123456789.1";
     Assert.AreNotEqual("123456789.1", pesel.PeselNumber);
 }
예제 #8
0
 public void setGoodPesel()
 {
     PeselValidator pesel = new PeselValidator();
     pesel.PeselNumber = "92092609898";
     Assert.AreEqual("92092609898", pesel.PeselNumber);
 }